diff --git a/src/modules/auth/hooks/useLogin.js b/src/modules/auth/hooks/useLogin.js index 33c2446..c550c35 100644 --- a/src/modules/auth/hooks/useLogin.js +++ b/src/modules/auth/hooks/useLogin.js @@ -50,7 +50,6 @@ export const useLogin = () => { } catch (e) { toast.error(e?.message || e?.response?.data?.error) } finally { - router.push("/facility") loading.value = false } diff --git a/src/shared/router/index.js b/src/shared/router/index.js index ddf8b6f..1c1bed5 100644 --- a/src/shared/router/index.js +++ b/src/shared/router/index.js @@ -15,17 +15,12 @@ const router = createRouter({ }) -/** - * return this line of code when the authentication is fixed - * - * router.beforeEach((to) => { - * const authStore = useAuthStore(pinia) - * return - * }) - * if (to.meta.requiresAuth && !authStore.accessToken) { - * // return {name: "login"} - * } - */ +router.beforeEach(to=>{ + const authStore = useAuthStore(pinia) + if(to.meta.requiresAuth && !authStore.accessToken){ + return {name: "login"} + } +}) router.beforeEach((to) => {