Add discover and section page routes with interfaces

This commit is contained in:
2026-03-10 23:50:25 +01:00
parent 0e11649e04
commit df9db461e5
2 changed files with 19 additions and 2 deletions

View File

@@ -3,4 +3,5 @@ import type { IList } from "./IList";
export default interface ISection {
title: string;
apiFunction: (page: number) => Promise<IList>;
sectionType?: "list" | "discover";
}

View File

@@ -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"];