Skip to content

Commit

Permalink
chore: returned the guard clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
PiusKariuki committed Jan 7, 2025
1 parent b8c4b01 commit 483a47f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion src/modules/auth/hooks/useLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const useLogin = () => {
} catch (e) {
toast.error(e?.message || e?.response?.data?.error)
} finally {
router.push("/facility")
loading.value = false
}

Expand Down
17 changes: 6 additions & 11 deletions src/shared/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 483a47f

Please sign in to comment.