feat: 账户列表展示受控头像
This commit is contained in:
@@ -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('头像读取失败');
|
||||
|
||||
Reference in New Issue
Block a user