113 lines
2.7 KiB
TypeScript
113 lines
2.7 KiB
TypeScript
import Vue from 'vue'
|
|
import Router from 'vue-router'
|
|
import Home from './views/Home.vue'
|
|
import store from './store'
|
|
|
|
Vue.use(Router)
|
|
|
|
const router: Router = new Router({
|
|
mode: 'history',
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
name: 'home',
|
|
component: Home,
|
|
},
|
|
{
|
|
path: '/about',
|
|
name: 'about',
|
|
component: () =>
|
|
import(/* webpackChunkName: "about" */ './views/About.vue'),
|
|
},
|
|
{
|
|
path: '/pricing',
|
|
name: 'pricing',
|
|
component: () =>
|
|
import(/* webpackChunkName: "pricing" */ './views/Pricing.vue'),
|
|
},
|
|
{
|
|
path: '/security',
|
|
name: 'security',
|
|
component: () =>
|
|
import(/* webpackChunkName: "pricing" */ './views/Security.vue'),
|
|
},
|
|
{
|
|
path: '/account/new',
|
|
name: 'account-new',
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "account-new" */ './views/accounts/AccountNew.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/account/:id',
|
|
name: 'account',
|
|
props: true,
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "account" */ './views/accounts/AccountItem.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/account/:id/public',
|
|
name: 'account-public',
|
|
props: true,
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "account-public" */ './views/accounts/AccountPublic.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/account/:id/transaction/new',
|
|
name: 'transaction-new',
|
|
props: true,
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "transaction-new" */ './views/transactions/TransactionNew.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/transaction/:id/update',
|
|
name: 'transaction-update',
|
|
props: true,
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "transaction-update" */ './views/transactions/TransactionUpdate.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/transaction/:id',
|
|
name: 'transaction',
|
|
props: true,
|
|
component: () =>
|
|
import(
|
|
/* webpackChunkName: "transaction" */ './views/transactions/TransactionItem.vue'
|
|
),
|
|
},
|
|
{
|
|
path: '/user',
|
|
name: 'user',
|
|
component: () =>
|
|
import(/* webpackChunkName: "user" */ './views/User.vue'),
|
|
},
|
|
{
|
|
path: '/user/:premail',
|
|
name: 'user-premail',
|
|
props: true,
|
|
component: () =>
|
|
import(/* webpackChunkName: "user" */ './views/User.vue'),
|
|
},
|
|
],
|
|
})
|
|
|
|
// tslint:disable-next-line:variable-name
|
|
router.beforeEach((to, _from, next) => {
|
|
const accountRoutes: string[] = ['account', 'transaction']
|
|
if (!accountRoutes.includes(to.name || '')) {
|
|
store.dispatch('setTitle', null)
|
|
}
|
|
next()
|
|
})
|
|
|
|
export default router
|