Handle redirects at root level

This commit is contained in:
Roman Cervantes 2019-01-23 23:18:34 -07:00
parent b04d43b722
commit 92c37dc556

View file

@ -50,15 +50,25 @@ export default {
},
mounted() {
if (this.user) {
this.syncData();
this.$router.push({ name: 'platforms' });
} else {
firebase.auth().getRedirectResult().then(({ user }) => {
if (user) {
this.init(user);
this.syncData();
this.$router.push({ name: 'platforms' });
} else {
const GoogleAuth = new firebase.auth.GoogleAuthProvider();
firebase.auth().signInWithRedirect(GoogleAuth)
.catch((error) => {
/* eslint-disable */
console.log(error);
});
}
});
if (this.user) {
this.syncData();
}
},