2
0
mirror of https://github.com/frappe/books.git synced 2024-11-15 17:57:08 +00:00
books/src/router/index.js

55 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-06-27 14:36:42 +00:00
import Vue from 'vue';
import Router from 'vue-router';
2018-06-01 12:35:51 +00:00
import ListView from '../pages/ListView';
import FormView from '../pages/FormView';
2018-10-15 12:05:01 +00:00
import PrintView from '../pages/PrintView';
2018-06-01 12:35:51 +00:00
2018-06-27 14:36:42 +00:00
import Report from 'frappejs/ui/pages/Report';
import reportViewConfig from '../../reports/view';
2018-06-01 12:35:51 +00:00
2018-10-10 10:32:56 +00:00
import DataImport from '../pages/DataImport';
2018-06-27 14:36:42 +00:00
Vue.use(Router);
const routes = [
2018-06-27 14:36:42 +00:00
{
2018-10-22 20:32:37 +00:00
path: '/list/:listName',
name: 'ListView',
component: ListView,
props: true
2018-06-27 14:36:42 +00:00
},
{
path: '/edit/:doctype/:name',
name: 'FormView',
component: FormView,
props: true
2018-10-15 12:05:01 +00:00
},
{
path: '/print/:doctype/:name',
name: 'PrintView',
component: PrintView,
props: true
2018-10-22 18:10:22 +00:00
},
2018-06-27 14:36:42 +00:00
{
path: '/report/:reportName',
name: 'Report',
component: Report,
props: (route) => {
const { reportName } = route.params;
return {
reportName,
reportConfig: reportViewConfig[reportName] || null,
filters: route.query
2018-06-27 14:36:42 +00:00
};
2018-06-01 12:35:51 +00:00
}
2018-10-10 10:32:56 +00:00
},
{
path: '/data-import',
name: 'Data Import',
component: DataImport
2018-06-27 14:36:42 +00:00
}
];
2018-06-27 14:36:42 +00:00
export default new Router({ routes });