UNPKG

@hperchec/scorpion-ui-template-default

Version:
93 lines (89 loc) 2.46 kB
/** * @vuepress * --- * title: ForgotPassword route * headline: ForgotPassword route * sidebarTitle: .ForgotPassword * 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 ForgotPassword * @static * @type {PublicRoute} * @description * - **Name**: ForgotPassword * - **Path**: `/forgot-password` * - **Params**: *none* * - **Query**: *none* */ export default { /** * @description Route path * @name ForgotPassword.path * @type {string} * @default /forgot-password */ path: '/forgot-password', /** * @description Route name * @name ForgotPassword.name * @type {string} * @default ForgotPassword */ name: 'ForgotPassword', /** * @alias Home.component * @returns {Object} * @description * Route component. By default, returns `Core.context.vue.components.public.views.forgotPassword.Index` */ component: () => Core.context.vue.components.public.views.forgotPassword.Index, /** * Options */ options: { /** * @description Route meta * @alias ForgotPassword.meta * @type {Object} */ meta: { /** * @alias ForgotPassword.meta.pageMeta * @type {Object} * @property {Function} title - Return translated ForgotPassword view title (translate: `views.ForgotPassword.Index.title`) * @description * Route page meta */ pageMeta: { title: (vm) => capitalize(translate('views.ForgotPassword.Index.title')) } }, /** * @alias ForgotPassword.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() } } } }