完善配送端列表头像展示

This commit is contained in:
czl231
2026-08-22 22:23:35 +08:00
parent 2e2c1a35dd
commit 5d4bd61672
10 changed files with 317 additions and 21 deletions

View File

@@ -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('头像读取失败');