2020-07-09 17:24:28 +02:00
|
|
|
import { RouteConfig, Route } from "vue-router";
|
2020-11-30 10:24:11 +01:00
|
|
|
import { EsModuleComponent } from "vue/types/options";
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
export enum GroupsRouteName {
|
|
|
|
TODO_LISTS = "TODO_LISTS",
|
|
|
|
TODO_LIST = "TODO_LIST",
|
|
|
|
TODO = "TODO",
|
|
|
|
GROUP_SETTINGS = "GROUP_SETTINGS",
|
|
|
|
GROUP_PUBLIC_SETTINGS = "GROUP_PUBLIC_SETTINGS",
|
|
|
|
GROUP_MEMBERS_SETTINGS = "GROUP_MEMBERS_SETTINGS",
|
|
|
|
RESOURCES = "RESOURCES",
|
|
|
|
RESOURCE_FOLDER_ROOT = "RESOURCE_FOLDER_ROOT",
|
|
|
|
RESOURCE_FOLDER = "RESOURCE_FOLDER",
|
2020-07-09 17:24:28 +02:00
|
|
|
POST_CREATE = "POST_CREATE",
|
|
|
|
POST_EDIT = "POST_EDIT",
|
|
|
|
POST = "POST",
|
|
|
|
POSTS = "POSTS",
|
2020-08-31 12:40:30 +02:00
|
|
|
GROUP_EVENTS = "GROUP_EVENTS",
|
2020-11-06 11:34:32 +01:00
|
|
|
GROUP_JOIN = "GROUP_JOIN",
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
const resourceFolder = (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Resources/ResourceFolder.vue");
|
|
|
|
const groupEvents = (): Promise<EsModuleComponent> =>
|
2020-08-31 12:40:30 +02:00
|
|
|
import(/* webpackChunkName: "groupEvents" */ "@/views/Event/GroupEvents.vue");
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
export const groupsRoutes: RouteConfig[] = [
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/todo-lists",
|
|
|
|
name: GroupsRouteName.TODO_LISTS,
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Todos/TodoLists.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
props: true,
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/todo-lists/:id",
|
|
|
|
name: GroupsRouteName.TODO_LIST,
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Todos/TodoList.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
props: true,
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/todo/:todoId",
|
|
|
|
name: GroupsRouteName.TODO,
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Todos/Todo.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
props: true,
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/resources",
|
|
|
|
name: GroupsRouteName.RESOURCE_FOLDER_ROOT,
|
|
|
|
component: resourceFolder,
|
|
|
|
props: { path: "/" },
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/resources/:path+",
|
|
|
|
name: GroupsRouteName.RESOURCE_FOLDER,
|
|
|
|
component: resourceFolder,
|
|
|
|
props: true,
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/settings",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Group/Settings.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
props: true,
|
|
|
|
meta: { requiredAuth: true },
|
|
|
|
redirect: { name: GroupsRouteName.GROUP_PUBLIC_SETTINGS },
|
|
|
|
name: GroupsRouteName.GROUP_SETTINGS,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "public",
|
|
|
|
name: GroupsRouteName.GROUP_PUBLIC_SETTINGS,
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("../views/Group/GroupSettings.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "members",
|
|
|
|
name: GroupsRouteName.GROUP_MEMBERS_SETTINGS,
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("../views/Group/GroupMembers.vue"),
|
2020-02-18 08:57:00 +01:00
|
|
|
props: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-07-09 17:24:28 +02:00
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/p/new",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Posts/Edit.vue"),
|
2020-07-09 17:24:28 +02:00
|
|
|
props: true,
|
|
|
|
name: GroupsRouteName.POST_CREATE,
|
2020-10-24 17:32:15 +02:00
|
|
|
meta: { requiredAuth: true },
|
2020-07-09 17:24:28 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/p/:slug/edit",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Posts/Edit.vue"),
|
|
|
|
props: (route: Route): Record<string, unknown> => ({
|
|
|
|
...route.params,
|
|
|
|
...{ isUpdate: true },
|
|
|
|
}),
|
2020-07-09 17:24:28 +02:00
|
|
|
name: GroupsRouteName.POST_EDIT,
|
2020-10-24 17:32:15 +02:00
|
|
|
meta: { requiredAuth: true },
|
2020-07-09 17:24:28 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/p/:slug",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Posts/Post.vue"),
|
2020-07-09 17:24:28 +02:00
|
|
|
props: true,
|
|
|
|
name: GroupsRouteName.POST,
|
2020-11-06 11:34:32 +01:00
|
|
|
meta: { requiredAuth: false },
|
2020-07-09 17:24:28 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/p",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/views/Posts/List.vue"),
|
2020-07-09 17:24:28 +02:00
|
|
|
props: true,
|
|
|
|
name: GroupsRouteName.POSTS,
|
2020-11-06 11:34:32 +01:00
|
|
|
meta: { requiredAuth: false },
|
2020-07-09 17:24:28 +02:00
|
|
|
},
|
2020-08-31 12:40:30 +02:00
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/events",
|
|
|
|
component: groupEvents,
|
|
|
|
props: true,
|
|
|
|
name: GroupsRouteName.GROUP_EVENTS,
|
2020-11-06 11:34:32 +01:00
|
|
|
meta: { requiredAuth: false },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "/@:preferredUsername/join",
|
2020-11-30 10:24:11 +01:00
|
|
|
component: (): Promise<EsModuleComponent> =>
|
|
|
|
import("@/components/Group/JoinGroupWithAccount.vue"),
|
2020-11-06 11:34:32 +01:00
|
|
|
props: true,
|
|
|
|
name: GroupsRouteName.GROUP_JOIN,
|
|
|
|
meta: { requiredAuth: false },
|
2020-08-31 12:40:30 +02:00
|
|
|
},
|
2020-02-18 08:57:00 +01:00
|
|
|
];
|