From 450047ef4be0d39ba8a5e5e5ac0d6e87b7203ebb Mon Sep 17 00:00:00 2001 From: Devlin Junker Date: Wed, 14 Dec 2022 22:07:16 -0800 Subject: rename to typescript file Signed-off-by: Devlin Junker --- src/routes/index.js | 44 -------------------------------------------- src/routes/index.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 44 deletions(-) delete mode 100644 src/routes/index.js create mode 100644 src/routes/index.ts (limited to 'src') diff --git a/src/routes/index.js b/src/routes/index.js deleted file mode 100644 index 6ced33c49..000000000 --- a/src/routes/index.js +++ /dev/null @@ -1,44 +0,0 @@ -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` -}) diff --git a/src/routes/index.ts b/src/routes/index.ts new file mode 100644 index 000000000..f54823d60 --- /dev/null +++ b/src/routes/index.ts @@ -0,0 +1,41 @@ +import VueRouter from 'vue-router' + +import ExplorePanel from '../components/Explore.vue' +import StarredPanel from '../components/Starred.vue' + +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, + }, +] + +export default new VueRouter({ + linkActiveClass: 'active', + routes, // short for `routes: routes` +}) -- cgit v1.2.3