budgeteer/web/src/main.ts
2022-02-04 16:34:23 +00:00

21 lines
581 B
TypeScript

import { createApp } from 'vue'
import App from './App.vue'
import './index.css'
import router from './router/routes.js'
import { store, key } from './store/index.js'
import { SET_CURRENT_ACCOUNT, SET_CURRENT_BUDGET } from './store/action-types'
const app = createApp(App)
app.use(router)
app.use(store, key)
app.mount('#app')
router.beforeEach(async (to, from, next) => {
await store.dispatch(SET_CURRENT_BUDGET, to.params.budgetid);
await store.dispatch(SET_CURRENT_ACCOUNT, {
accountid: to.params.accountid,
budgetid: to.params.budgetid
});
next();
})