Initial commit

This commit is contained in:
2022-10-17 19:26:56 +02:00
commit 0370f5f00c
25 changed files with 30799 additions and 0 deletions

11
middleware/auth.js Normal file
View File

@@ -0,0 +1,11 @@
export default function ({ $auth, store, route, redirect }) {
// If Firebase Auth hasn't been initialized yet, redirect to index page
if (!store.state.firebaseInitialized && route.name !== 'index') {
return redirect({ name: 'index' })
}
// If the user attempts to access any site other than the login page without being logged in,
// redirect to login page
else if (store.state.firebaseInitialized && (!$auth.currentUser && route.name !== 'login')) {
return redirect({ name: 'login' })
}
}