diff options
author | HampusM <hampus@hampusmat.com> | 2021-06-05 19:37:52 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-06-05 19:37:52 +0200 |
commit | 4da3272bf7893760f6710c9a1ec7de02358136e6 (patch) | |
tree | 92eb961bf20a7ef9f7c0650ba288baf512986fca /packages/client/src/router/index.js | |
parent | 4e3074dfd752dd52951d300090c642aee76cfaac (diff) |
Reorganized into a monorepo, refactored the frontend again, goodbye Parcel
Diffstat (limited to 'packages/client/src/router/index.js')
-rw-r--r-- | packages/client/src/router/index.js | 46 |
1 files changed, 46 insertions, 0 deletions
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; |