2019-06-22 18:52:24 +03:00
|
|
|
import Vue from "vue";
|
|
|
|
import VueRouter, { RouteConfig } from "vue-router";
|
2019-06-23 19:18:41 +03:00
|
|
|
import Splash from "./components/Splash.vue";
|
|
|
|
import { authGuard, authRedirectGuard, loginCallbackGuard } from "./auth";
|
2019-06-22 18:52:24 +03:00
|
|
|
|
|
|
|
Vue.use(VueRouter);
|
|
|
|
|
|
|
|
export const router = new VueRouter({
|
|
|
|
mode: "history",
|
2019-06-23 19:18:41 +03:00
|
|
|
routes: [
|
|
|
|
{ path: "/", component: Splash },
|
|
|
|
{ path: "/login", beforeEnter: authRedirectGuard },
|
|
|
|
{ path: "/login-callback", beforeEnter: loginCallbackGuard },
|
|
|
|
|
2019-07-28 18:24:32 +03:00
|
|
|
// Docs
|
|
|
|
{
|
|
|
|
path: "/docs",
|
2019-09-29 15:53:14 +03:00
|
|
|
component: () => import("./components/docs/DocsLayout.vue"),
|
2019-07-28 18:24:32 +03:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/docs/Introduction.vue"),
|
2019-07-28 18:24:32 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "configuration-format",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/docs/ConfigurationFormat.vue"),
|
2019-07-28 18:24:32 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "permissions",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/docs/Permissions.vue"),
|
2019-07-28 18:24:32 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "plugin-configuration",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/docs/PluginConfiguration.vue"),
|
2019-07-28 18:24:32 +03:00
|
|
|
},
|
2019-07-29 18:55:32 +02:00
|
|
|
{
|
2019-08-22 01:22:26 +03:00
|
|
|
path: "descriptions/argument-types",
|
|
|
|
component: () => import("./components/docs/ArgumentTypes.vue"),
|
2019-07-29 18:55:32 +02:00
|
|
|
},
|
2019-07-28 20:13:01 +03:00
|
|
|
{
|
2019-09-29 15:53:14 +03:00
|
|
|
path: "plugins/:pluginName/:tab?",
|
2019-08-22 01:22:26 +03:00
|
|
|
component: () => import("./components/docs/Plugin.vue"),
|
2019-07-28 20:13:01 +03:00
|
|
|
},
|
2019-07-28 18:24:32 +03:00
|
|
|
],
|
|
|
|
},
|
|
|
|
|
2019-06-23 19:18:41 +03:00
|
|
|
// Dashboard
|
|
|
|
{
|
|
|
|
path: "/dashboard",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/dashboard/Layout.vue"),
|
2019-06-23 19:18:41 +03:00
|
|
|
beforeEnter: authGuard,
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/dashboard/GuildList.vue"),
|
2019-06-23 19:18:41 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "guilds/:guildId/config",
|
2019-07-28 18:26:36 +03:00
|
|
|
component: () => import("./components/dashboard/GuildConfigEditor.vue"),
|
2019-06-23 19:18:41 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2019-07-29 18:55:32 +02:00
|
|
|
|
2019-08-22 01:22:26 +03:00
|
|
|
scrollBehavior(to, from, savedPosition) {
|
2019-07-29 18:55:32 +02:00
|
|
|
if (to.hash) {
|
|
|
|
return {
|
|
|
|
selector: to.hash,
|
|
|
|
};
|
2019-08-22 01:22:26 +03:00
|
|
|
} else if (savedPosition) {
|
|
|
|
return savedPosition;
|
|
|
|
} else {
|
|
|
|
return { x: 0, y: 0 };
|
2019-07-29 18:55:32 +02:00
|
|
|
}
|
|
|
|
},
|
2019-06-22 18:52:24 +03:00
|
|
|
});
|