UNPKG

@hperchec/scorpion-ui-template-default

Version:
93 lines (89 loc) 2.24 kB
/** * @vuepress * --- * title: SignUp route * headline: SignUp route * sidebarTitle: .SignUp * sidebarDepth: 0 # To disable auto sidebar links * prev: false # Disable prev link * next: false # Disable prev link * --- */ import { Core, utils } from '@hperchec/scorpion-ui' const { capitalize } = utils const translate = (...args) => Core.context.services['router'].options.translate(...args) // eslint-disable-line dot-notation /** * @name SignUp * @static * @type {PublicRoute} * @description * - **Name**: SignUp * - **Path**: `/sign-up` * - **Params**: *none* * - **Query**: *none* */ export default { /** * @description Route path * @name SignUp.path * @type {string} * @default /sign-up */ path: '/sign-up', /** * @description Route name * @name SignUp.name * @type {string} * @default SignUp */ name: 'SignUp', /** * @description Route component * @alias SignUp.component * @type {Object} * @default SignUp */ component: () => Core.context.vue.components.public.views.signUp.Index, /** * Options */ options: { /** * @description Route meta * @alias SignUp.meta * @type {Object} */ meta: { /** * @alias SignUp.meta.pageMeta * @type {Object} * @property {Function} title - Return translated SignUp view title (translate: `views.SignUp.Index.title`) * @description * SignUp page meta */ pageMeta: { title: (vm) => capitalize(translate('views.SignUp.Index.title')) } }, /** * @alias SignUp.beforeEnter * @type {Function} * @return {void} * @description * > See also [beforeEnter per-route guard documentation](https://v3.router.vuejs.org/guide/advanced/navigation-guards.html#per-route-guard) * * Redirect if already authenticated */ beforeEnter: async (to, from, next) => { const authenticated = Core.store.state.Core.Auth.currentUser // Redirect if authenticated if (authenticated) { next({ path: from.fullPath }) } else { next() } } } }