diff options
author | Devlin Junker <devlin.junker@gmail.com> | 2022-12-04 09:10:04 -0800 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-12-23 12:54:31 +0100 |
commit | f517bc37f766bee93a23122448c0a7bb5af9665d (patch) | |
tree | 35e09d7397db8d717dad16897c528a13831291f3 /src/routes | |
parent | cec18279ac8ba66444d50164d4b95dc000db8fd0 (diff) |
split out routing and add another route
Signed-off-by: Devlin Junker <devlin.junker@gmail.com>
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/index.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/routes/index.js b/src/routes/index.js new file mode 100644 index 000000000..6ced33c49 --- /dev/null +++ b/src/routes/index.js @@ -0,0 +1,44 @@ +import Vue from 'vue' +import VueRouter from 'vue-router' + +import ExplorePanel from '../components/Explore' +import StarredPanel from '../components/Starred' + +export const ROUTES = { + EXPLORE: 'explore', + STARRED: 'starred', +} + +const getInitialRoute = function() { + // TODO: Fetch Recent route from Browser Session? + return ROUTES.EXPLORE +} + +const routes = [ + // using + // { path: '/collections/all', component: CollectionGeneral, alias: '/' }, + // instead of + { path: '/', redirect: getInitialRoute() }, + // would also be an option, but it currently does not work + // reliably with router-link due to + // https://github.com/vuejs/vue-router/issues/419 + { + name: ROUTES.EXPLORE, + path: '/explore', + component: ExplorePanel, + props: true, + }, + { + name: ROUTES.STARRED, + path: '/starred', + component: StarredPanel, + props: true, + }, +] + +Vue.use(VueRouter) + +export default new VueRouter({ + linkActiveClass: 'active', + routes, // short for `routes: routes` +}) |