2019-06-03 13:06:44 +02:00
|
|
|
import Vue from 'vue'
|
|
|
|
import VueRouter from 'vue-router'
|
|
|
|
|
2019-07-24 17:20:44 +02:00
|
|
|
import Home from 'vuejs/components/Pages/Home'
|
|
|
|
import Base from 'vuejs/components/Pages/Base'
|
|
|
|
import Blabla from 'vuejs/components/Pages/Blabla'
|
|
|
|
import Article from 'vuejs/components/Pages/Article'
|
|
|
|
import Showrooms from 'vuejs/components/Pages/Showrooms'
|
2019-10-05 20:01:06 +02:00
|
|
|
import Pricing from 'vuejs/components/Pages/Pricing'
|
|
|
|
import Cart from 'vuejs/components/Pages/Cart'
|
2019-06-03 13:06:44 +02:00
|
|
|
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
|
2019-06-04 22:38:44 +02:00
|
|
|
// https://www.lullabot.com/articles/decoupled-hard-problems-routing
|
|
|
|
|
2019-06-06 17:37:43 +02:00
|
|
|
// We could use aliases to never reload the page on language changement
|
|
|
|
// BUT beforeupdate is not triggered when push alias instead of path or name
|
2019-07-14 15:21:04 +02:00
|
|
|
// const languages = ['en', 'fr'];
|
|
|
|
// console.log('path aliases', (() => languages.map(l => `/${l}/base`))() );
|
2019-06-06 17:37:43 +02:00
|
|
|
|
|
|
|
let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
|
|
|
|
|
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
name: 'home',
|
|
|
|
path: basePath,
|
|
|
|
// path: '/',
|
|
|
|
// alias: (() => languages.map(l => `/${l}`))(),
|
|
|
|
component: Home
|
|
|
|
// components: {
|
|
|
|
// 'home': Home
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'base',
|
|
|
|
path: `${basePath}base`,
|
|
|
|
// path: `/base`,
|
|
|
|
// alias: (() => languages.map(l => `/${l}/base`))(),
|
|
|
|
component: Base,
|
|
|
|
// components: {
|
|
|
|
// 'base': Base
|
|
|
|
// }
|
|
|
|
},
|
2019-07-14 15:21:04 +02:00
|
|
|
// {
|
|
|
|
// name:'blabla',
|
|
|
|
// path: `${basePath}blabla`,
|
|
|
|
// component: Blabla,
|
|
|
|
// children: [
|
|
|
|
// {
|
|
|
|
// path: `${basePath}blabla/:alias`,
|
|
|
|
// component: Article
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
2019-07-12 22:15:09 +02:00
|
|
|
{
|
|
|
|
name:'blabla',
|
|
|
|
path: `${basePath}blabla`,
|
2019-07-14 15:21:04 +02:00
|
|
|
component: Blabla
|
2019-07-12 22:15:09 +02:00
|
|
|
},
|
2019-07-14 15:21:04 +02:00
|
|
|
{
|
|
|
|
name:'article',
|
|
|
|
path: `${basePath}blabla/:alias`,
|
|
|
|
component: Article,
|
|
|
|
// meta: { uuid:null }
|
2019-07-24 17:20:44 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'showrooms',
|
|
|
|
path: `${basePath}showrooms`,
|
|
|
|
component: Showrooms,
|
|
|
|
// meta: { uuid:null }
|
2019-10-05 20:01:06 +02:00
|
|
|
},
|
2019-06-06 17:37:43 +02:00
|
|
|
// {
|
|
|
|
// path: '*',
|
|
|
|
// name: 'notfound',
|
|
|
|
// components: {
|
|
|
|
// 'notfound': NotFound
|
|
|
|
// }
|
2019-10-05 20:01:06 +02:00
|
|
|
// },
|
|
|
|
{
|
|
|
|
name:'pricing',
|
|
|
|
path: `${basePath}pricing`,
|
|
|
|
component: Pricing
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name:'cart',
|
|
|
|
path: `${basePath}cart`,
|
|
|
|
component: Cart
|
|
|
|
}
|
2019-06-06 17:37:43 +02:00
|
|
|
]
|
|
|
|
|
2019-06-03 13:06:44 +02:00
|
|
|
export default new VueRouter({
|
2019-06-04 22:38:44 +02:00
|
|
|
mode: 'history',
|
2019-06-06 17:37:43 +02:00
|
|
|
routes: routes
|
2019-06-03 13:06:44 +02:00
|
|
|
})
|