initial commit
All checks were successful
Build and Publish / Build Yale Access Backend (push) Successful in 28s
Build and Publish / Build Yale Access Frontend (push) Successful in 47s
Build and Publish / Push Yale Access Backend Docker Image (push) Successful in 9s
Build and Publish / Push Yale Access Frontend Docker Image (push) Successful in 10s
All checks were successful
Build and Publish / Build Yale Access Backend (push) Successful in 28s
Build and Publish / Build Yale Access Frontend (push) Successful in 47s
Build and Publish / Push Yale Access Backend Docker Image (push) Successful in 9s
Build and Publish / Push Yale Access Frontend Docker Image (push) Successful in 10s
This commit is contained in:
9
packages/frontend/middleware/authentication.global.ts
Normal file
9
packages/frontend/middleware/authentication.global.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
const anonymousRoutes = ['/login', '/health'];
|
||||
|
||||
export default defineNuxtRouteMiddleware((to, from) => {
|
||||
// If the route is not the login page and the user is not logged in then redirect to login
|
||||
const authenticated = useCookie<boolean>('authenticated');
|
||||
if (!anonymousRoutes.includes(to.path) && !(authenticated.value) ) {
|
||||
return navigateTo('/login');
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user