diff --git a/frontend/src/app.d.ts b/frontend/src/app.d.ts
index 2ff658b..54c991c 100644
--- a/frontend/src/app.d.ts
+++ b/frontend/src/app.d.ts
@@ -6,7 +6,17 @@ declare global {
// interface Locals {}
// interface PageData {}
// interface Platform {}
-
+ interface Category {
+ "id": 1,
+ "name_it": "Natura",
+ "name_en": "Nature",
+ "description_it": "Giri nella natura",
+ "description_en": "Countryside routes",
+ "icon": "",
+ "created_at": null,
+ "updated_at": null,
+ "deleted_at": null
+ }
interface Sport {
"id": 1,
"name_it": "Trekking",
diff --git a/frontend/src/routes/paths/[slug]/+page.server.ts b/frontend/src/routes/paths/[slug]/+page.server.ts
deleted file mode 100644
index a8579ae..0000000
--- a/frontend/src/routes/paths/[slug]/+page.server.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { error } from "@sveltejs/kit";
-
-
-export async function load({ params }) {
- return {
- title: params.slug,
- routes: [
- {id: 1, name: 'Pianello 1', image: '/images/test-1.jpg', duration: 1233},
- {id: 2, name: 'Pianello 2', image: '/images/test-1.jpg', duration: 1233},
- {id: 3, name: 'Pianello 3', image: '/images/test-1.jpg', duration: 2134},
- {id: 4, name: 'Pianello 4', image: '/images/test-1.jpg', duration: 2134 * 4},
- {id: 5, name: 'Pianello 5', image: '/images/test-1.jpg', duration: 2134 * 4},
- ]
- }
-}
diff --git a/frontend/src/routes/paths/[slug]/+page.svelte b/frontend/src/routes/paths/[slug]/+page.svelte
index 869fc46..d7ccd6f 100644
--- a/frontend/src/routes/paths/[slug]/+page.svelte
+++ b/frontend/src/routes/paths/[slug]/+page.svelte
@@ -1,22 +1,14 @@
-
+
-{#each routes as route}
+{#each data.routes as route}
{/each}
diff --git a/frontend/src/routes/paths/[slug]/+page.ts b/frontend/src/routes/paths/[slug]/+page.ts
new file mode 100644
index 0000000..5287e1f
--- /dev/null
+++ b/frontend/src/routes/paths/[slug]/+page.ts
@@ -0,0 +1,19 @@
+import { getRouteByCategory, getRouteCategories } from '$lib/repo.js';
+import { error } from '@sveltejs/kit';
+
+/** @type {import('./$types').PageLoad} */
+export async function load({ params }) {
+ const categories: App.Category[] = await getRouteCategories();
+ const categoryId = Number(params.slug);
+
+ const category: App.Category = categories.find(c => c.id === categoryId);
+
+ if (!category) {
+ error(404);
+ }
+
+ return {
+ category: category.name_it,
+ routes: await getRouteByCategory(categoryId),
+ }
+}
\ No newline at end of file
diff --git a/frontend/src/routes/routes/[slug]/+page.svelte b/frontend/src/routes/routes/[slug]/+page.svelte
index c490db1..e5bc7e7 100644
--- a/frontend/src/routes/routes/[slug]/+page.svelte
+++ b/frontend/src/routes/routes/[slug]/+page.svelte
@@ -6,6 +6,8 @@
export let data: App.Route;
let divider;
+
+ const mapClick = () => {};
@@ -14,7 +16,7 @@
Percorso {data.name_it}
-
Dislivello {data.elevation_gain}
+
Dislivello {data.route_sport_details[0].elevation_gain} m
diff --git a/frontend/src/routes/routes/[slug]/+page.ts b/frontend/src/routes/routes/[slug]/+page.ts
index 1821bbc..e078e99 100644
--- a/frontend/src/routes/routes/[slug]/+page.ts
+++ b/frontend/src/routes/routes/[slug]/+page.ts
@@ -1,7 +1,7 @@
-import { getRoute } from '$lib/repo.js';
+import { getRouteByCategory } from '$lib/repo.js';
import { error } from '@sveltejs/kit';
/** @type {import('./$types').PageLoad} */
export async function load({ params }) {
- return await getRoute(params.slug);
+ return await getRouteByCategory(params.slug);
}
\ No newline at end of file