mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-03-02 17:21:15 +01:00
19 lines
510 B
JavaScript
19 lines
510 B
JavaScript
|
import { useTwofaccounts } from '@/stores/twofaccounts'
|
||
|
|
||
|
/**
|
||
|
* Allows the user to access the main view only if he owns at least one twofaccount.
|
||
|
* Push to the starter view otherwise.
|
||
|
*/
|
||
|
export default function starter({ to, next }) {
|
||
|
const twofaccounts = useTwofaccounts()
|
||
|
|
||
|
if (twofaccounts.isEmpty) {
|
||
|
twofaccounts.refresh().then(() => {
|
||
|
if (twofaccounts.isEmpty) {
|
||
|
next({ name: 'start' });
|
||
|
}
|
||
|
else next()
|
||
|
})
|
||
|
}
|
||
|
else next()
|
||
|
}
|