diff --git a/src/interfaces/ISection.ts b/src/interfaces/ISection.ts index 6196636..b2b197f 100644 --- a/src/interfaces/ISection.ts +++ b/src/interfaces/ISection.ts @@ -3,4 +3,5 @@ import type { IList } from "./IList"; export default interface ISection { title: string; apiFunction: (page: number) => Promise; + sectionType?: "list" | "discover"; } diff --git a/src/routes.ts b/src/routes.ts index 3bc48af..b636375 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -39,7 +39,17 @@ const routes: RouteRecordRaw[] = [ { name: "list", path: "/list/:name", - component: () => import("./pages/ListPage.vue") + component: () => import("./pages/SectionPage.vue") + }, + { + name: "discover-section", + path: "/discover/:name", + component: () => import("./pages/SectionPage.vue") + }, + { + name: "discover", + path: "/discover", + component: () => import("./pages/DiscoverPage.vue") }, { name: "search", @@ -104,7 +114,13 @@ const router = createRouter({ history: createWebHistory("/"), // base: "/", routes, - linkActiveClass: "is-active" + linkActiveClass: "is-active", + scrollBehavior(to, from, savedPosition) { + if (to.name !== "discover") return; + + console.log("scrolling top"); + return { top: 0 }; + } }); const loggedIn = () => store.getters["user/loggedIn"];