Use accounts from the storage

This commit is contained in:
Rodolphe Bréard 2023-07-30 16:40:58 +02:00
parent 0e394cccd8
commit f93198ebee
2 changed files with 30 additions and 21 deletions

View file

@ -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
},
]
});