修缮 snack
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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}]`,
|
||||
|
||||
Reference in New Issue
Block a user