Skip to content

Commit

Permalink
fix login sometimes having to login twice (calcom#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT authored Oct 1, 2021
1 parent 3d3e992 commit 08f83dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pages/auth/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export default function Login({ csrfToken }) {
callbackUrl,
});
if (!response) {
console.error("Received empty response from next auth");
return;
throw new Error("Received empty response from next auth");
}

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;
}

Expand All @@ -63,9 +63,9 @@ export default function Login({ csrfToken }) {
} else {
setErrorMessage(errorMessages[response.error] || "Something went wrong.");
}
setIsSubmitting(false);
} catch (e) {
setErrorMessage("Something went wrong.");
} finally {
setIsSubmitting(false);
}
}
Expand Down

0 comments on commit 08f83dd

Please sign in to comment.