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'
|
2020-12-25 17:37:15 +01:00
|
|
|
import Thematique from 'vuejs/components/Pages/Thematique'
|
2019-07-24 17:20:44 +02:00
|
|
|
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'
|
2019-10-07 17:32:14 +02:00
|
|
|
// 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'];
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('path aliases', (() => languages.map(l => `/${l}/base`))())
|
2019-06-06 17:37:43 +02:00
|
|
|
|
2020-11-26 22:45:46 +01:00
|
|
|
const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix
|
2019-06-06 17:37:43 +02:00
|
|
|
|
|
|
|
const routes = [
|
|
|
|
{
|
|
|
|
name: 'home',
|
|
|
|
path: basePath,
|
|
|
|
// path: '/',
|
|
|
|
// alias: (() => languages.map(l => `/${l}`))(),
|
|
|
|
component: Home
|
|
|
|
// components: {
|
|
|
|
// 'home': Home
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
{
|
2020-11-26 22:45:46 +01:00
|
|
|
name: 'base',
|
2019-06-06 17:37:43 +02:00
|
|
|
path: `${basePath}base`,
|
|
|
|
// path: `/base`,
|
|
|
|
// alias: (() => languages.map(l => `/${l}/base`))(),
|
2020-11-26 22:45:46 +01:00
|
|
|
component: Base
|
2019-06-06 17:37:43 +02:00
|
|
|
// components: {
|
|
|
|
// 'base': Base
|
|
|
|
// }
|
|
|
|
},
|
2020-12-25 17:37:15 +01:00
|
|
|
{
|
|
|
|
name: 'thematique',
|
|
|
|
path: `${basePath}thematique/:alias`,
|
|
|
|
component: Thematique
|
|
|
|
},
|
2019-07-12 22:15:09 +02:00
|
|
|
{
|
2020-11-26 22:45:46 +01:00
|
|
|
name: 'blabla',
|
2019-07-12 22:15:09 +02:00
|
|
|
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
|
|
|
{
|
2020-11-26 22:45:46 +01:00
|
|
|
name: 'article',
|
2019-07-14 15:21:04 +02:00
|
|
|
path: `${basePath}blabla/:alias`,
|
2020-11-26 22:45:46 +01:00
|
|
|
component: Article
|
2019-07-14 15:21:04 +02:00
|
|
|
// meta: { uuid:null }
|
2019-07-24 17:20:44 +02:00
|
|
|
},
|
|
|
|
{
|
2020-11-26 22:45:46 +01:00
|
|
|
name: 'showrooms',
|
2019-07-24 17:20:44 +02:00
|
|
|
path: `${basePath}showrooms`,
|
2020-11-26 22:45:46 +01:00
|
|
|
component: Showrooms
|
2019-07-24 17:20:44 +02:00
|
|
|
// 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
|
|
|
// },
|
|
|
|
{
|
2020-11-26 22:45:46 +01:00
|
|
|
name: 'pricing',
|
2019-10-05 20:01:06 +02:00
|
|
|
path: `${basePath}pricing`,
|
|
|
|
component: Pricing
|
|
|
|
}
|
2019-10-07 17:32:14 +02:00
|
|
|
// {
|
|
|
|
// 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
|
|
|
})
|