mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-18 09:29:46 +02:00
Enable the Vue 3 front-end
This commit is contained in:
17
resources/js/router/middlewares/starter.js
vendored
Normal file
17
resources/js/router/middlewares/starter.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Allows an authenticated user to access the main view only if he owns at least one twofaccount.
|
||||
* Push to the starter view otherwise.
|
||||
*/
|
||||
export default async function starter({ to, next, nextMiddleware, stores }) {
|
||||
const { twofaccounts } = stores
|
||||
|
||||
if (twofaccounts.isEmpty) {
|
||||
await twofaccounts.fetch().then(() => {
|
||||
if (twofaccounts.isEmpty) {
|
||||
next({ name: 'start' })
|
||||
}
|
||||
else nextMiddleware()
|
||||
})
|
||||
}
|
||||
else nextMiddleware()
|
||||
}
|
Reference in New Issue
Block a user