Skip to content

Commit

Permalink
feat: navigate away from login on login
Browse files Browse the repository at this point in the history
  • Loading branch information
thraizz committed Feb 8, 2024
1 parent 9e30471 commit a01be1c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/GoogleSSO.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ const router = useRouter();
const signIn = async () => {
const provider = new GoogleAuthProvider();
await setPersistence(auth, browserLocalPersistence);
signInWithPopup(auth, provider).catch(async (e) => {
if (typeof e === "object" && errorHasCode(e)) {
if (e.code === "auth/popup-blocked") {
await signInWithRedirect(auth, provider).then(() => router.push("/"));
signInWithPopup(auth, provider)
.then(() => router.push("/"))
.catch(async (e) => {
if (typeof e === "object" && errorHasCode(e)) {
if (e.code === "auth/popup-blocked") {
await signInWithRedirect(auth, provider).then(() => router.push("/"));
}
}
}
});
});
};
</script>

Expand Down

0 comments on commit a01be1c

Please sign in to comment.