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

138 lines
3.9 KiB
TypeScript
Raw Normal View History

import { i18n } from "@/utils/i18n";
import { RouteLocationNormalized, RouteRecordRaw } from "vue-router";
2019-02-22 14:55:47 +01:00
const t = i18n.global.t;
const participations = () => import("@/views/Event/ParticipantsView.vue");
const editEvent = () => import("@/views/Event/EditView.vue");
const event = () => import("@/views/Event/EventView.vue");
const myEvents = () => import("@/views/Event/MyEventsView.vue");
2019-02-22 14:55:47 +01:00
export enum EventRouteName {
EVENT_LIST = "EventList",
CREATE_EVENT = "CreateEvent",
MY_EVENTS = "MyEvents",
EDIT_EVENT = "EditEvent",
2020-04-23 00:27:09 +02:00
DUPLICATE_EVENT = "DuplicateEvent",
PARTICIPATIONS = "Participations",
EVENT = "Event",
EVENT_PARTICIPATE_WITH_ACCOUNT = "EVENT_PARTICIPATE_WITH_ACCOUNT",
EVENT_PARTICIPATE_WITHOUT_ACCOUNT = "EVENT_PARTICIPATE_WITHOUT_ACCOUNT",
EVENT_PARTICIPATE_LOGGED_OUT = "EVENT_PARTICIPATE_LOGGED_OUT",
EVENT_PARTICIPATE_CONFIRM = "EVENT_PARTICIPATE_CONFIRM",
TAG = "Tag",
2019-02-22 14:55:47 +01:00
}
export const eventRoutes: RouteRecordRaw[] = [
2019-02-22 14:55:47 +01:00
{
path: "/events/create",
2019-02-22 14:55:47 +01:00
name: EventRouteName.CREATE_EVENT,
2019-09-02 14:35:50 +02:00
component: editEvent,
meta: {
requiredAuth: true,
announcer: { message: (): string => t("Create event") as string },
},
2019-02-22 14:55:47 +01:00
},
{
path: "/events/me",
name: EventRouteName.MY_EVENTS,
component: myEvents,
props: true,
meta: {
requiredAuth: true,
announcer: { message: (): string => t("My events") as string },
},
},
2019-02-22 14:55:47 +01:00
{
path: "/events/edit/:eventId",
2019-02-22 14:55:47 +01:00
name: EventRouteName.EDIT_EVENT,
2019-09-02 14:35:50 +02:00
component: editEvent,
meta: { requiredAuth: true, announcer: { skip: true } },
props: (route: RouteLocationNormalized): Record<string, unknown> => {
return { ...route.params, ...{ isUpdate: true } };
},
2020-04-23 00:27:09 +02:00
},
{
path: "/events/duplicate/:eventId",
name: EventRouteName.DUPLICATE_EVENT,
component: editEvent,
meta: { requiredAuth: true, announce: { skip: true } },
props: (route: RouteLocationNormalized): Record<string, unknown> => ({
...route.params,
...{ isDuplicate: true },
}),
2019-02-22 14:55:47 +01:00
},
{
path: "/events/:eventId/participations",
name: EventRouteName.PARTICIPATIONS,
component: participations,
meta: { requiredAuth: true, announcer: { skip: true } },
props: true,
},
2019-02-22 14:55:47 +01:00
{
path: "/events/:uuid",
2019-02-22 14:55:47 +01:00
name: EventRouteName.EVENT,
component: event,
2019-02-22 14:55:47 +01:00
props: true,
meta: { requiredAuth: false, announcer: { skip: true } },
2019-02-22 14:55:47 +01:00
},
{
path: "/events/:uuid/participate",
name: EventRouteName.EVENT_PARTICIPATE_LOGGED_OUT,
component: () =>
import("../components/Participation/UnloggedParticipation.vue"),
props: true,
meta: {
announcer: {
message: (): string => t("Unlogged participation") as string,
},
},
},
{
path: "/events/:uuid/participate/with-account",
name: EventRouteName.EVENT_PARTICIPATE_WITH_ACCOUNT,
component: () =>
import("../components/Participation/ParticipationWithAccount.vue"),
meta: {
announcer: {
message: (): string => t("Participation with account") as string,
},
},
props: true,
},
{
path: "/events/:uuid/participate/without-account",
name: EventRouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT,
component: () =>
import("../components/Participation/ParticipationWithoutAccount.vue"),
meta: {
announcer: {
message: (): string => t("Participation without account") as string,
},
},
props: true,
},
{
path: "/participation/email/confirm/:token",
name: EventRouteName.EVENT_PARTICIPATE_CONFIRM,
component: () =>
import("../components/Participation/ConfirmParticipation.vue"),
meta: {
announcer: {
message: (): string => t("Confirm participation") as string,
},
},
props: true,
},
{
path: "/tag/:tag",
name: EventRouteName.TAG,
component: () => import("@/views/SearchView.vue"),
props: true,
meta: {
requiredAuth: false,
announcer: { message: (): string => t("Tag search") as string },
},
},
2019-02-22 14:55:47 +01:00
];