完善配送端列表头像展示
This commit is contained in:
@@ -37,10 +37,14 @@ async function upload(file: File): Promise<AvatarUploadReply> {
|
||||
}
|
||||
|
||||
/** 读取配送点权限范围内的受保护头像。 */
|
||||
async function load(resource: string, identity: string): Promise<Blob | undefined> {
|
||||
async function load(
|
||||
resource: string,
|
||||
identity: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<Blob | undefined> {
|
||||
const response = await fetch(
|
||||
`${deliveryApiBaseURL}${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