fix: login 410 error tip

This commit is contained in:
Tristan Yang
2022-06-23 21:58:26 +08:00
parent 0310d764ac
commit e53ebd63a7
5 changed files with 48 additions and 27 deletions
+16 -1
View File
@@ -29,7 +29,7 @@ interface Props {
}
const GoogleLoginButton: FC<Props> = ({ type = "login", clientId }) => {
const [login, { isSuccess, isLoading }] = useLoginMutation();
const [login, { isSuccess, isLoading, error }] = useLoginMutation();
//拿本地存的magic token
const magic_token = localStorage.getItem(KEY_LOCAL_MAGIC_TOKEN);
const { signIn, loaded } = useGoogleLogin({
@@ -56,6 +56,21 @@ const GoogleLoginButton: FC<Props> = ({ type = "login", clientId }) => {
// navigateTo("/");
}
}, [isSuccess]);
useEffect(() => {
if (error) {
switch (error.status) {
case 410:
toast.error(
"No associated account found, please contact admin for an invitation link to join."
);
break;
default:
toast.error("Something Error");
break;
}
return;
}
}, [error]);
const handleGoogleLogin = () => {
signIn();
};