UNPKG

@hperchec/scorpion-ui-template-default

Version:
94 lines (90 loc) 2.46 kB
/** * @vuepress * --- * title: ResetPassword route * headline: ResetPassword route * sidebarTitle: .ResetPassword * 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 ResetPassword * @static * @type {PublicRoute} * @description * - **Name**: ResetPassword * - **Path**: `/reset-password` * - **Params**: * - `token {String}`: The temporary token to reset password * - **Query**: *none* */ export default { /** * @description Route path * @name ResetPassword.path * @type {string} * @default /reset-password/:token */ path: '/reset-password/:token', /** * @description Route name * @name ResetPassword.name * @type {string} * @default ResetPassword */ name: 'ResetPassword', /** * @description Route component * @alias ResetPassword.component * @type {Object} * @default ResetPassword */ component: () => Core.context.vue.components.public.views.resetPassword.Index, /** * Options */ options: { /** * @description Route meta * @alias ResetPassword.meta * @type {Object} */ meta: { /** * @alias ResetPassword.meta.pageMeta * @type {Object} * @property {Function} title - Return translated ResetPassword view title (translate: `views.ResetPassword.Index.title`) * @description * ResetPassword page meta */ pageMeta: { title: (vm) => capitalize(translate('views.ResetPassword.Index.title')) } }, /** * @alias ResetPassword.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() } } } }