Rework Shop pages and switch to page endpoints

- Create ShopHeader component to reuse on pages
- Use page endpoints to query data from API and Swell
- Remove use of `stuff`
This commit is contained in:
2022-06-07 16:58:57 +02:00
parent 152961996d
commit 3bd7061cd2
6 changed files with 264 additions and 322 deletions

View File

@@ -41,10 +41,10 @@
<script context="module" lang="ts">
import type { LoadEvent, LoadOutput } from '@sveltejs/kit'
import { fetchAPI } from '$utils/api'
/** @type {import('@sveltejs/kit').Load} */
export async function load ({ url, params, fetch, session, stuff }) {
export async function load ({ fetch }: LoadEvent): Promise<LoadOutput> {
// Get content from API
const res = await fetchAPI(`
query {
@@ -92,7 +92,7 @@
}
`)
const { data: { shop, location, posters } } = res
const { data: { shop, location, posters }} = res
/**
@@ -123,11 +123,6 @@
posters,
shopProducts,
},
stuff: {
shop,
posters,
shopProducts,
}
}
}
</script>