mirror of
https://github.com/kevin-DL/comedy-video-lib.git
synced 2026-01-11 19:04:27 +00:00
Logged in/ Logged out
- Created midlewares for authenticated and guest] - Add the token to the api calls - Added redirect after the login
This commit is contained in:
6
middleware/authenticated.js
Normal file
6
middleware/authenticated.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default function ({ store, redirect }) {
|
||||
// If the user is not authenticated
|
||||
if (!store.state.auth.loggedIn) {
|
||||
return redirect('/login')
|
||||
}
|
||||
}
|
||||
6
middleware/guest.js
Normal file
6
middleware/guest.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default function ({ store, redirect }) {
|
||||
// If the user is not authenticated
|
||||
if (store.state.auth.loggedIn) {
|
||||
return redirect('/')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user