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

120 lines
3.6 KiB
TypeScript
Raw Normal View History

2020-04-23 00:27:09 +02:00
import { RouteConfig, Route } from "vue-router";
import EventList from "../views/Event/EventList.vue";
import Location from "../views/Location.vue";
import Search from "../views/Search.vue";
2019-02-22 14:55:47 +01:00
const participations = () =>
import(/* webpackChunkName: "participations" */ "@/views/Event/Participants.vue");
const editEvent = () => import(/* webpackChunkName: "edit-event" */ "@/views/Event/Edit.vue");
const event = () => import(/* webpackChunkName: "event" */ "@/views/Event/Event.vue");
const myEvents = () => import(/* webpackChunkName: "my-events" */ "@/views/Event/MyEvents.vue");
2019-02-22 14:55:47 +01:00
export enum EventRouteName {
EVENT_LIST = "EventList",
CREATE_EVENT = "CreateEvent",
MY_EVENTS = "MyEvents",
EXPLORE = "Explore",
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",
LOCATION = "Location",
TAG = "Tag",
2019-02-22 14:55:47 +01:00
}
export const eventRoutes: RouteConfig[] = [
2019-02-22 14:55:47 +01:00
{
path: "/events/list/:location?",
2019-02-22 14:55:47 +01:00
name: EventRouteName.EVENT_LIST,
component: EventList,
meta: { requiredAuth: false },
},
{
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,
2019-02-22 14:55:47 +01:00
meta: { requiredAuth: true },
},
{
path: "/events/explore",
name: EventRouteName.EXPLORE,
redirect: { name: "Search" },
meta: { requiredAuth: false },
},
{
path: "/events/me",
name: EventRouteName.MY_EVENTS,
component: myEvents,
meta: { requiredAuth: true },
},
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,
2019-02-22 14:55:47 +01:00
meta: { requiredAuth: true },
2020-04-23 00:27:09 +02:00
props: (route: Route) => ({ ...route.params, ...{ isUpdate: true } }),
},
{
path: "/events/duplicate/:eventId",
name: EventRouteName.DUPLICATE_EVENT,
component: editEvent,
meta: { requiredAuth: true },
props: (route: Route) => ({ ...route.params, ...{ isDuplicate: true } }),
2019-02-22 14:55:47 +01:00
},
{
path: "/events/:eventId/participations",
name: EventRouteName.PARTICIPATIONS,
component: participations,
meta: { requiredAuth: true },
props: true,
},
2019-02-22 14:55:47 +01:00
{
path: "/location/new",
2019-02-22 14:55:47 +01:00
name: EventRouteName.LOCATION,
component: Location,
meta: { requiredAuth: true },
},
{
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 },
},
{
path: "/events/:uuid/participate",
name: EventRouteName.EVENT_PARTICIPATE_LOGGED_OUT,
component: () => import("../components/Participation/UnloggedParticipation.vue"),
props: true,
},
{
path: "/events/:uuid/participate/with-account",
name: EventRouteName.EVENT_PARTICIPATE_WITH_ACCOUNT,
component: () => import("../components/Participation/ParticipationWithAccount.vue"),
props: true,
},
{
path: "/events/:uuid/participate/without-account",
name: EventRouteName.EVENT_PARTICIPATE_WITHOUT_ACCOUNT,
component: () => import("../components/Participation/ParticipationWithoutAccount.vue"),
props: true,
},
{
path: "/participation/email/confirm/:token",
name: EventRouteName.EVENT_PARTICIPATE_CONFIRM,
component: () => import("../components/Participation/ConfirmParticipation.vue"),
props: true,
},
{
path: "/tag/:tag",
name: EventRouteName.TAG,
component: Search,
props: true,
meta: { requiredAuth: false },
},
2019-02-22 14:55:47 +01:00
];