fix: 优化权限不足提示

This commit is contained in:
hh
2026-07-15 14:43:29 +08:00
parent 44148dad0e
commit 92fa85ef8c
+4
View File
@@ -132,6 +132,10 @@ async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
if (response.status === 401 && AUTH_MISSING_MESSAGES.has(message)) { if (response.status === 401 && AUTH_MISSING_MESSAGES.has(message)) {
message = FRIENDLY_AUTH_MISSING_MESSAGE; message = FRIENDLY_AUTH_MISSING_MESSAGE;
} }
// 团队接口统一用此 403 表示当前账号不具备操作资格;只翻译精确原文,避免掩盖其他 403 原因。
if (response.status === 403 && message === "permission denied") {
message = "当前账号权限不足";
}
throw new ApiError(response.status, message); throw new ApiError(response.status, message);
} }
if (response.status === 204) return undefined as T; if (response.status === 204) return undefined as T;