mirror of
https://gitlab.com/bramw/baserow.git
synced 2025-04-10 07:37:30 +00:00
13 lines
416 B
JavaScript
13 lines
416 B
JavaScript
/**
|
|
* If this middleware is added to a page, it will redirect back to the login
|
|
* page if the user is not authenticated.
|
|
*/
|
|
export default function({ req, store, redirect }) {
|
|
// If nuxt generate, pass this middleware
|
|
if (process.server && !req) return
|
|
|
|
// If the user is not authenticated we will redirect him to the login page.
|
|
if (!store.getters['auth/isAuthenticated']) {
|
|
redirect('/login')
|
|
}
|
|
}
|