mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 04:45:02 +00:00
Dashboard work and related
This commit is contained in:
parent
7bda2b1763
commit
b230a73a6f
44 changed files with 637 additions and 272 deletions
|
@ -1,30 +1,37 @@
|
|||
import Vue from "vue";
|
||||
import VueRouter, { RouteConfig } from "vue-router";
|
||||
import Index from "./components/Index.vue";
|
||||
import Splash from "./components/Splash.vue";
|
||||
import Login from "./components/Login.vue";
|
||||
import LoginCallback from "./components/LoginCallback.vue";
|
||||
import GuildConfigEditor from "./components/GuildConfigEditor.vue";
|
||||
import DashboardGuildList from "./components/DashboardGuildList.vue";
|
||||
import DashboardGuildConfigEditor from "./components/DashboardGuildConfigEditor.vue";
|
||||
import Dashboard from "./components/Dashboard.vue";
|
||||
import { authGuard, loginCallbackGuard } from "./auth";
|
||||
import { authGuard, authRedirectGuard, loginCallbackGuard } from "./auth";
|
||||
|
||||
Vue.use(VueRouter);
|
||||
|
||||
const publicRoutes: RouteConfig[] = [
|
||||
{ path: "/", component: Index },
|
||||
{ path: "/login", component: Login },
|
||||
{ path: "/login-callback", beforeEnter: loginCallbackGuard },
|
||||
];
|
||||
|
||||
const authenticatedRoutes: RouteConfig[] = [
|
||||
{ path: "/dashboard", component: Dashboard },
|
||||
{ path: "/dashboard/guilds/:guildId/config", component: GuildConfigEditor },
|
||||
];
|
||||
|
||||
authenticatedRoutes.forEach(route => {
|
||||
route.beforeEnter = authGuard;
|
||||
});
|
||||
|
||||
export const router = new VueRouter({
|
||||
mode: "history",
|
||||
routes: [...publicRoutes, ...authenticatedRoutes],
|
||||
routes: [
|
||||
{ path: "/", component: Splash },
|
||||
{ path: "/login", beforeEnter: authRedirectGuard },
|
||||
{ path: "/login-callback", beforeEnter: loginCallbackGuard },
|
||||
|
||||
// Dashboard
|
||||
{
|
||||
path: "/dashboard",
|
||||
component: Dashboard,
|
||||
beforeEnter: authGuard,
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
component: DashboardGuildList,
|
||||
},
|
||||
{
|
||||
path: "guilds/:guildId/config",
|
||||
component: DashboardGuildConfigEditor,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue