feat: 账户列表展示受控头像

This commit is contained in:
czl231
2026-08-11 11:49:50 +08:00
parent ed6e2f7d75
commit 5738a43f3e
9 changed files with 405 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
/**
* 功能:平台总后台头像上传与鉴权读取客户端。
* 版本v1.0.0
* 版本v1.1.0
*/
import { getToken } from '@/utils/auth';
@@ -49,10 +49,11 @@ async function upload(file: File): Promise<AvatarUploadReply> {
async function load(
resource: string,
identity: string,
signal?: AbortSignal,
): Promise<Blob | undefined> {
const response = await fetch(
`${platformApiBaseURL}${resource}/${encodeURIComponent(identity)}/avatar`,
{ headers: authorizationHeaders() },
{ headers: authorizationHeaders(), signal },
);
if (response.status === 404) return undefined;
if (!response.ok) throw new Error('头像读取失败');