debian-mirror-gitlab/app/assets/javascripts/repository/router.js

30 lines
718 B
JavaScript
Raw Normal View History

2019-09-04 21:01:54 +05:30
import Vue from 'vue';
import VueRouter from 'vue-router';
import { joinPaths } from '../lib/utils/url_utility';
import IndexPage from './pages/index.vue';
import TreePage from './pages/tree.vue';
Vue.use(VueRouter);
export default function createRouter(base, baseRef) {
return new VueRouter({
mode: 'history',
base: joinPaths(gon.relative_url_root || '', base),
routes: [
{
2020-05-05 14:28:15 +05:30
path: `(/-)?/tree/${baseRef}/:path*`,
2019-09-04 21:01:54 +05:30
name: 'treePath',
component: TreePage,
props: route => ({
2020-03-13 15:44:24 +05:30
path: route.params.path?.replace(/^\//, '') || '/',
2019-09-04 21:01:54 +05:30
}),
},
{
path: '/',
name: 'projectRoot',
component: IndexPage,
},
],
});
}