mobilizon.chapril.org-mobil.../js/src/router/user.ts

99 lines
2.9 KiB
TypeScript
Raw Normal View History

import { beforeRegisterGuard } from "@/router/guards/register-guard";
import { Route, RouteConfig } from "vue-router";
import { EsModuleComponent } from "vue/types/options";
2019-02-22 14:55:47 +01:00
export enum UserRouteName {
REGISTER = "Register",
REGISTER_PROFILE = "RegisterProfile",
RESEND_CONFIRMATION = "ResendConfirmation",
SEND_PASSWORD_RESET = "SendPasswordReset",
PASSWORD_RESET = "PasswordReset",
EMAIL_VALIDATE = "EMAIL_VALIDATE",
VALIDATE = "Validate",
LOGIN = "Login",
2019-02-22 14:55:47 +01:00
}
export const userRoutes: RouteConfig[] = [
2019-02-22 11:24:41 +01:00
{
path: "/register/user",
2019-02-22 14:55:47 +01:00
name: UserRouteName.REGISTER,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "RegisterUser" */ "@/views/User/Register.vue"
),
2019-02-22 11:24:41 +01:00
props: true,
meta: { requiredAuth: false },
beforeEnter: beforeRegisterGuard,
2019-02-22 11:24:41 +01:00
},
{
path: "/register/profile",
2019-02-22 14:55:47 +01:00
name: UserRouteName.REGISTER_PROFILE,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "RegisterProfile" */ "@/views/Account/Register.vue"
),
// We can only pass string values through params, therefore
props: (route: Route): Record<string, unknown> => ({
email: route.params.email,
userAlreadyActivated: route.params.userAlreadyActivated === "true",
}),
2019-02-22 11:24:41 +01:00
meta: { requiredAuth: false },
},
{
path: "/resend-instructions",
2019-02-22 14:55:47 +01:00
name: UserRouteName.RESEND_CONFIRMATION,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "ResendConfirmation" */ "@/views/User/ResendConfirmation.vue"
),
2019-02-22 11:24:41 +01:00
props: true,
meta: { requiresAuth: false },
},
{
path: "/password-reset/send",
2019-02-22 14:55:47 +01:00
name: UserRouteName.SEND_PASSWORD_RESET,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "SendPasswordReset" */ "@/views/User/SendPasswordReset.vue"
),
2019-02-22 11:24:41 +01:00
props: true,
meta: { requiresAuth: false },
},
{
path: "/password-reset/:token",
2019-02-22 14:55:47 +01:00
name: UserRouteName.PASSWORD_RESET,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "PasswordReset" */ "@/views/User/PasswordReset.vue"
),
2019-02-22 11:24:41 +01:00
meta: { requiresAuth: false },
props: true,
},
{
path: "/validate/email/:token",
name: UserRouteName.EMAIL_VALIDATE,
component: (): Promise<EsModuleComponent> =>
import(
/* webpackChunkName: "EmailValidate" */ "@/views/User/EmailValidate.vue"
),
props: true,
meta: { requiresAuth: false },
},
2019-02-22 11:24:41 +01:00
{
path: "/validate/:token",
2019-02-22 14:55:47 +01:00
name: UserRouteName.VALIDATE,
component: (): Promise<EsModuleComponent> =>
import(/* webpackChunkName: "Validate" */ "@/views/User/Validate.vue"),
props: true,
2019-02-22 11:24:41 +01:00
meta: { requiresAuth: false },
},
{
path: "/login",
2019-02-22 14:55:47 +01:00
name: UserRouteName.LOGIN,
component: (): Promise<EsModuleComponent> =>
import(/* webpackChunkName: "Login" */ "@/views/User/Login.vue"),
2019-02-22 11:24:41 +01:00
props: true,
meta: { requiredAuth: false },
},
];