diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 0547b16..dfc006d 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -78,11 +78,12 @@ const Index = () => { try { const res = await request.get("/auth/user", { headers: { Authorization: `Basic ${encodedAuth}` }, - withCredentials: true, + withCredentials: ifNeedCookie, }); // console.log(res); if (res.data.requiresTwoFactorAuth) { setIfNeedCode(true); + setIsSubmitting(false); return; } @@ -138,15 +139,15 @@ const Index = () => { {ifNeedCode && ( - 验证码: + 邮箱验证码: handleFormChange({ authCode: val })} /> - handleLogin(false)}>没收到?尝试清除cookie再试一次 + handleLogin(false)}>没收到验证码?点击此处重发验证码 )} (set => ({ // headers: { Authorization: `Basic ${encodedAuth}` }, // withCredentials: false, }); + if (!res.data?.id) { + set({ loading: false }); + return; + } set({ userInfo: res.data, loading: false }); } catch (e) { set({ loading: false });