pref: 代码打包优化
This commit is contained in:
@@ -153,26 +153,28 @@ export const AuthProvider = ({ children }) => {
|
||||
setUser(data.user);
|
||||
setIsAuthenticated(true);
|
||||
|
||||
toast({
|
||||
title: "登录成功",
|
||||
description: "欢迎回来!",
|
||||
status: "success",
|
||||
duration: 3000,
|
||||
isClosable: true,
|
||||
});
|
||||
// ⚡ 移除toast,让调用者处理UI反馈,避免并发更新冲突
|
||||
// toast({
|
||||
// title: "登录成功",
|
||||
// description: "欢迎回来!",
|
||||
// status: "success",
|
||||
// duration: 3000,
|
||||
// isClosable: true,
|
||||
// });
|
||||
|
||||
return { success: true };
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 登录错误:', error);
|
||||
|
||||
toast({
|
||||
title: "登录失败",
|
||||
description: error.message || "请检查您的登录信息",
|
||||
status: "error",
|
||||
duration: 3000,
|
||||
isClosable: true,
|
||||
});
|
||||
// ⚡ 移除toast,让调用者处理错误显示,避免重复toast和并发更新
|
||||
// toast({
|
||||
// title: "登录失败",
|
||||
// description: error.message || "请检查您的登录信息",
|
||||
// status: "error",
|
||||
// duration: 3000,
|
||||
// isClosable: true,
|
||||
// });
|
||||
|
||||
return { success: false, error: error.message };
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user