From 4da3272bf7893760f6710c9a1ec7de02358136e6 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 5 Jun 2021 19:37:52 +0200 Subject: Reorganized into a monorepo, refactored the frontend again, goodbye Parcel --- packages/client/src/router/index.js | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 packages/client/src/router/index.js (limited to 'packages/client/src/router/index.js') diff --git a/packages/client/src/router/index.js b/packages/client/src/router/index.js new file mode 100644 index 0000000..69cd036 --- /dev/null +++ b/packages/client/src/router/index.js @@ -0,0 +1,46 @@ +import { createRouter, createWebHashHistory } from "vue-router"; +import Home from "../views/Home"; + +const routes = [ + { + path: "/", + name: "Home", + component: Home + }, + { + path: "/:repo([a-zA-Z0-9\\.\\-_]+)", + name: "Repository", + component: () => import("../views/Repository"), + props: route => ({ repository: route.params.repo }), + children: [ + { + path: "log", + name: "Repository Log", + component: () => import("../views/RepositoryLog") + }, + { + path: "log/:commit([a-fA-F0-9]{40}$)", + name: "Commit", + component: () => import("../views/RepositoryCommit"), + props: route => ({ commit: route.params.commit }) + }, + { + path: "tree/:path*", + name: "Tree Entry", + component: () => import("../views/RepositoryTree"), + props: route => ({ pathArr: route.params.path ? route.params.path : [] }) + }, + { + path: "", + redirect: to => `/${to.params.repo}/log` + } + ] + } +]; + +const router = createRouter({ + history: createWebHashHistory(), + routes +}); + +export default router; -- cgit v1.2.3-18-g5258