From 39c38c737114dc7f946b1895b2a4ba27a5546c60 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 6 Jul 2021 13:07:07 +0200 Subject: Migrated frontend to typescript --- packages/client/src/router/index.ts | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 packages/client/src/router/index.ts (limited to 'packages/client/src/router/index.ts') diff --git a/packages/client/src/router/index.ts b/packages/client/src/router/index.ts new file mode 100644 index 0000000..27ea978 --- /dev/null +++ b/packages/client/src/router/index.ts @@ -0,0 +1,54 @@ +import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"; + +const routes: RouteRecordRaw[] = [ + { + path: "/", + name: "Home", + component: () => import("../views/Home.vue") + }, + { + path: "/:repo([a-zA-Z0-9\\.\\-_]+)", + name: "Repository", + component: () => import("../views/Repository.vue"), + props: route => ({ repository: route.params.repo }), + children: [ + { + path: "about", + name: "About", + component: () => import("../views/RepositoryAbout.vue") + }, + { + path: "log", + name: "Log", + component: () => import("../views/RepositoryLog.vue") + }, + { + path: "log/:commit([a-fA-F0-9]{40}$)", + name: "Commit", + component: () => import("../views/RepositoryCommit.vue"), + props: route => ({ commit: route.params.commit }) + }, + { + path: "tree/:path*", + name: "Tree", + component: () => import("../views/RepositoryTree.vue"), + props: route => ({ pathArr: route.params.path ? route.params.path : [] }) + } + /* { + path: "", + component: () => import("../views/RepositoryRedirect") + } */ + ] + }, + { + path: "/:PageNotFound(.*)*", + component: () => import("../views/PageNotFound.vue") + } +]; + +const router = createRouter({ + history: createWebHashHistory(), + routes +}); + +export default router; -- cgit v1.2.3-18-g5258