import errorUtil from '@/common/services/error-util'

import routerService from '@/common/services/router-service'
import flowService from './flow-service'

routerService.route('/sd-webflow/:type/:mode*/:id', {
  component: './sd-webflow-panel.vue',
  name: 'sd-webflow',
  beforeEnter: (to, from, next) => {
    to.meta.preData = flowService.getData(to.params) // 提前获取数据
    next()
  },
})
routerService.route('/sd-easy-webflow', {
  component: './sd-easy-webflow.vue',
})
// 后面需要考虑下更多参数的情况
routerService.route('/sd-create-webflow', {
  component: null,
  redirect: 'sd-webflow/pages/draft/0',
})

errorUtil.addHandler(['10201002', '10201003', '10201001', '11901001', '11001'], function(data) {
  errorUtil.handleErrorDefault(data)
})
