fix middleware pipeline for the Accounts route

This commit is contained in:
Bubka 2023-11-06 13:17:13 +01:00
parent 5f99bf594a
commit 7ebadf278f
3 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ const router = createRouter({
{ path: '/start', name: 'start', component: () => import('../views/Start.vue'), meta: { middlewares: [authGuard, setReturnTo] } },
{ path: '/capture', name: 'capture', component: () => import('../views/twofaccounts/Capture.vue'), meta: { middlewares: [authGuard, setReturnTo] } },
{ path: '/accounts', name: 'accounts', component: () => import('../views/twofaccounts/Accounts.vue'), meta: { middlewares: [authGuard, starter, setReturnTo] }, alias: '/' },
{ path: '/accounts', name: 'accounts', component: () => import('../views/twofaccounts/Accounts.vue'), meta: { middlewares: [authGuard, setReturnTo, starter] }, alias: '/' },
{ path: '/account/create', name: 'createAccount', component: () => import('../views/twofaccounts/CreateUpdate.vue'), meta: { middlewares: [authGuard, setReturnTo] } },
{ path: '/account/import', name: 'importAccounts', component: () => import('../views/twofaccounts/Import.vue'), meta: { middlewares: [authGuard, setReturnTo] } },
{ path: '/account/:twofaccountId/edit', name: 'editAccount', component: () => import('../views/twofaccounts/CreateUpdate.vue'), meta: { middlewares: [authGuard, setReturnTo] }, props: true },

View File

@ -1,6 +1,6 @@
import authService from '@/services/authService'
export default async function auth({ to, next, stores }) {
export default async function authGuard({ to, next, stores }) {
const { user } = stores
// No authenticated user on the front-end side, we try to

View File

@ -8,7 +8,7 @@ export default function starter({ to, next, stores }) {
if (twofaccounts.isEmpty) {
twofaccounts.fetch().then(() => {
if (twofaccounts.isEmpty) {
next({ name: 'start' });
next({ name: 'start' })
}
else next()
})