Use accounts from the storage
This commit is contained in:
parent
0e394cccd8
commit
f93198ebee
2 changed files with 30 additions and 21 deletions
|
@ -1,13 +1,26 @@
|
|||
import {createRouter, createMemoryHistory} from 'vue-router';
|
||||
import { useStorage } from '@vueuse/core'
|
||||
|
||||
import MainView from '../views/MainView.vue';
|
||||
import AddAccountView from '../views/AddAccountView.vue';
|
||||
|
||||
const accounts = useStorage('sake-accounts', []);
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: [
|
||||
{path: '/', component: MainView},
|
||||
{path: '/add-account', component: AddAccountView},
|
||||
{
|
||||
path: '/',
|
||||
component: MainView,
|
||||
beforeEnter: (to, from) => {
|
||||
if (!accounts.value.length) {
|
||||
return '/add-account';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/add-account',
|
||||
component: AddAccountView
|
||||
},
|
||||
]
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue