From fda1c9e531f0c14d1e73c1db161f074b9abfda09 Mon Sep 17 00:00:00 2001 From: m1ngsama Date: Sun, 18 Oct 2026 16:59:43 +0800 Subject: [PATCH] fix(repair): show why a photo upload failed Name expired logins and missing permissions, and include the status and server detail for other failures so a storage error can be told apart without server logs. --- src/pages/repair/EventPhotos.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/repair/EventPhotos.tsx b/src/pages/repair/EventPhotos.tsx index 1980e15..b404c21 100644 --- a/src/pages/repair/EventPhotos.tsx +++ b/src/pages/repair/EventPhotos.tsx @@ -73,7 +73,9 @@ export default function EventPhotos(props: { }) if (data) props.onUploaded(data) else if (response.status === 422) setError(`上传失败:${reasons[error?.detail ?? ""] ?? "照片没有通过检查,请换一张再试"}`) - else setError("上传失败,请稍后再试") + else if (response.status === 401) setError("登录已过期,请重新登录后再上传") + else if (response.status === 403) setError("你没有添加照片的权限") + else setError(`上传失败(${response.status}${error?.detail ? ` ${error.detail}` : ""}),请稍后再试`) } catch { setError("网络异常,上传失败,请稍后再试")