Skip to content

Commit

Permalink
Login errors and error messages handled
Browse files Browse the repository at this point in the history
  • Loading branch information
kronaemmanuel committed Mar 7, 2021
1 parent bfdfadc commit ed562c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ function Login(props) {
currentUser.uid
);
if (userExists) {
console.log("User exists in collection");
router.push("/dashboard");
} else {
console.log("User doesn't exist in collection");
try {
await props.firebase.setupUserInCollection(currentUser);
router.push("/dashboard");
} catch (err) {
console.error("Error while setting up user in database");
setStatus(err.message);
}
}
} catch (err) {
console.error("Error while checking if user exists in database");
setStatus(err.message);
}
} catch (err) {
console.error("Error while logging in user: ", err);
setStatus("Error while logging user in: ", err.message);
} finally {
router.push("/calendar");
setStatus(err.message);
}
},
});
Expand Down

0 comments on commit ed562c6

Please sign in to comment.