Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #146 from s0lvang/fix_refresh_redirect
Browse files Browse the repository at this point in the history
fixes redirect to login when you refresh
  • Loading branch information
s0lvang authored Mar 19, 2020
2 parents 478e82e + 3e1c1da commit ab906bf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import MyRequestsView from "@/views/MyRequestsView.vue"; // eslint-disable
import MyAssignedRequestsView from "@/views/MyAssignedRequestsView.vue"; // eslint-disable
import EditRequestView from "@/views/EditRequestView.vue";
import MyPageView from "@/views/MyPageView.vue";

import store from "@/store/index";
import firebase from "firebase";

Vue.use(VueRouter);

Expand Down Expand Up @@ -98,7 +97,7 @@ const router = new VueRouter({

router.beforeEach((to, from, next) => {
const requiresAuth = to.matched.some(x => x.meta.requiresAuth);
const { currentUser } = store.getters;
const { currentUser } = firebase.auth();
if (requiresAuth && !currentUser) {
next("/login");
} else if (requiresAuth && currentUser) {
Expand Down

0 comments on commit ab906bf

Please sign in to comment.