hs.hsadmin.ng/vue/src/router.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-04-03 17:54:05 +02:00
import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import HSAdmin from "./hsadmin.js"
Vue.use(Router);
const hsa = new HSAdmin({
baseURL: `http://localhost:${process.env.VUE_APP_API_PORT || 8080}/api`,
});
2019-04-03 17:54:05 +02:00
const routeProps = (route) => {
return Object.assign({}, route.params,{
hsadmin: hsa
});
};
export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: "/login",
name: "login",
component: () => import(/* webpackChunkName: "login" */ "./views/Login.vue"),
props: routeProps,
},
{
path: "/customers",
name: "customers",
component: () => import(/* webpackChunkName: "customers" */ "./views/Customers.vue"),
props: routeProps,
},
{
path: "/customers/:id",
name: "customer",
component: () => import(/* webpackChunkName: "customers" */ "./views/Customer.vue"),
props: routeProps,
},
]
})