修缮 snack

This commit is contained in:
CrescentLeaf
2025-11-21 21:52:17 +08:00
parent 32719b45ea
commit cbdccfb5a7
4 changed files with 8 additions and 8 deletions

View File

@@ -40,9 +40,9 @@ export default function ContactsList({
token: data.access_token,
})
if (re.code != 200) {
if (re.code != 401) checkApiSuccessOrSncakbar(re, "获取收藏对话列表失败")
return
}
if (re.code != 401 && re.code != 400) checkApiSuccessOrSncakbar(re, "获取收藏对话列表失败")
return
}
const ls = re.data!.contacts_list as Chat[]
setContactsList(ls)
setSharedFavouriteChats(ls)
@@ -53,7 +53,7 @@ export default function ContactsList({
EventBus.off('ContactsList.updateContacts')
}
// 警告: 不添加 deps 導致無限執行
}, [])
}, [])
return <mdui-list style={{
overflowY: 'auto',

View File

@@ -36,7 +36,7 @@ export default function RecentsList({
token: data.access_token,
})
if (re.code != 200) {
if (re.code != 401) checkApiSuccessOrSncakbar(re, "获取最近对话列表失败")
if (re.code != 401 && re.code != 400) checkApiSuccessOrSncakbar(re, "获取最近对话列表失败")
return
}

View File

@@ -86,7 +86,7 @@ interface SnackbarOptions extends Options {
export function checkApiSuccessOrSncakbar(re: ApiCallbackMessage, msg_ahead: string, opinions_override: Options = {}): Snackbar | null {
return re.code != 200 ? snackbar(
Object.assign({
message: `${msg_ahead}: ${re.msg.indexOf("Failed to fetch") != -1
message: `${msg_ahead}: ${re.msg.indexOf("fetch") != -1
? "HTTP 请求失败"
: re.msg
} [${re.code}]`,