summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/design_management/router/routes.js
blob: 1b07d8aeb76465b88e253e3c27d5f9f49c039e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Home from '../pages/index.vue';
import DesignDetail from '../pages/design/index.vue';
import { DESIGNS_ROUTE_NAME, DESIGN_ROUTE_NAME } from './constants';

export default [
  {
    name: DESIGNS_ROUTE_NAME,
    path: '/',
    component: Home,
    alias: '/designs',
  },
  {
    name: DESIGN_ROUTE_NAME,
    path: '/designs/:id',
    component: DesignDetail,
    beforeEnter({ params: { id } }, _, next) {
      if (typeof id === 'string') {
        next();
      }
    },
    props: ({ params: { id } }) => ({ id }),
  },
];