Commit
·
2f84eb7
1
Parent(s):
2597131
🐛 Workaround to sveltekit's bug
Browse files
src/routes/+layout.svelte
CHANGED
@@ -10,8 +10,9 @@
|
|
10 |
|
11 |
export let data: LayoutData;
|
12 |
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
let menuOpen = false;
|
17 |
let date = new Date();
|
|
|
10 |
|
11 |
export let data: LayoutData;
|
12 |
|
13 |
+
// See https://github.com/sveltejs/kit/issues/8272 for the reason why we can't just $page.data?.pictures
|
14 |
+
$: pictures = ($page.data?.page?.pictures as typeof data.pictures) ?? data.pictures;
|
15 |
+
$: shownPicture = pictures.find((p) => p.storage[0].width >= p.storage[0].height) ?? pictures[0];
|
16 |
|
17 |
let menuOpen = false;
|
18 |
let date = new Date();
|
src/routes/vente/[id]/+page.server.ts
CHANGED
@@ -21,7 +21,9 @@ export const load: PageServerLoad = async (input) => {
|
|
21 |
product,
|
22 |
title: `${product.name} - ${product.price} €`,
|
23 |
description: product.description,
|
24 |
-
|
|
|
|
|
25 |
type: 'og:product',
|
26 |
price: product.price
|
27 |
};
|
|
|
21 |
product,
|
22 |
title: `${product.name} - ${product.price} €`,
|
23 |
description: product.description,
|
24 |
+
page: {
|
25 |
+
pictures: product.photos
|
26 |
+
},
|
27 |
type: 'og:product',
|
28 |
price: product.price
|
29 |
};
|