summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/design_management/router/routes.js
blob: 788910e55144c42b97f73b968f0b360ea3888af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import Home from '../pages/index.vue';
import DesignDetail from '../pages/design/index.vue';
import { ROOT_ROUTE_NAME, DESIGNS_ROUTE_NAME, DESIGN_ROUTE_NAME } from './constants';

export default [
  {
    name: ROOT_ROUTE_NAME,
    path: '/',
    component: Home,
    meta: {
      el: 'discussion',
    },
  },
  {
    name: DESIGNS_ROUTE_NAME,
    path: '/designs',
    component: Home,
    meta: {
      el: 'designs',
    },
    children: [
      {
        name: DESIGN_ROUTE_NAME,
        path: ':id',
        component: DesignDetail,
        meta: {
          el: 'designs',
        },
        beforeEnter(
          {
            params: { id },
          },
          from,
          next,
        ) {
          if (typeof id === 'string') {
            next();
          }
        },
        props: ({ params: { id } }) => ({ id }),
      },
    ],
  },
];