fix login sometimes having to login twice (#839)
parent
3d3e99272a
commit
08f83dd85c
|
@ -48,12 +48,12 @@ export default function Login({ csrfToken }) {
|
||||||
callbackUrl,
|
callbackUrl,
|
||||||
});
|
});
|
||||||
if (!response) {
|
if (!response) {
|
||||||
console.error("Received empty response from next auth");
|
throw new Error("Received empty response from next auth");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!response.error) {
|
if (!response.error) {
|
||||||
router.replace(callbackUrl);
|
// we're logged in! let's do a hard refresh to the desired url
|
||||||
|
window.location.replace(callbackUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ export default function Login({ csrfToken }) {
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage(errorMessages[response.error] || "Something went wrong.");
|
setErrorMessage(errorMessages[response.error] || "Something went wrong.");
|
||||||
}
|
}
|
||||||
|
setIsSubmitting(false);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setErrorMessage("Something went wrong.");
|
setErrorMessage("Something went wrong.");
|
||||||
} finally {
|
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue