Add authentication followup to front-end to ease navigation & redirects

This commit is contained in:
Bubka
2023-08-04 15:13:30 +02:00
parent afd020019b
commit a80a002ce7
5 changed files with 26 additions and 6 deletions

View File

@ -79,7 +79,13 @@ router.beforeEach((to, from, next) => {
isFirstLoad = false;
}
if (to.matched.some(record => record.meta.disabledWithAuthProxy)) {
// See https://github.com/garethredfern/laravel-vue/ if one day the middleware pattern
// becomes relevant (i.e when some admin only pages are necessary)
if (to.name !== 'login' && to.meta.requiresAuth && ! Vue.$storage.get('authenticated', false)) {
next({ name: 'login' })
}
else if (to.matched.some(record => record.meta.disabledWithAuthProxy)) {
if (window.appConfig.proxyAuth) {
next({ name: 'accounts' })
}