mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 11:55:38 +00:00
Add discover and section page routes with interfaces
This commit is contained in:
@@ -3,4 +3,5 @@ import type { IList } from "./IList";
|
|||||||
export default interface ISection {
|
export default interface ISection {
|
||||||
title: string;
|
title: string;
|
||||||
apiFunction: (page: number) => Promise<IList>;
|
apiFunction: (page: number) => Promise<IList>;
|
||||||
|
sectionType?: "list" | "discover";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,17 @@ const routes: RouteRecordRaw[] = [
|
|||||||
{
|
{
|
||||||
name: "list",
|
name: "list",
|
||||||
path: "/list/:name",
|
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",
|
name: "search",
|
||||||
@@ -104,7 +114,13 @@ const router = createRouter({
|
|||||||
history: createWebHistory("/"),
|
history: createWebHistory("/"),
|
||||||
// base: "/",
|
// base: "/",
|
||||||
routes,
|
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"];
|
const loggedIn = () => store.getters["user/loggedIn"];
|
||||||
|
|||||||
Reference in New Issue
Block a user