Add error page on Shop

This commit is contained in:
2022-06-07 16:36:39 +02:00
parent dbf586618d
commit 29cb3a30ba
2 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
<script lang="ts">
import { getContext } from 'svelte'
import Metas from '$components/Metas.svelte'
import PageTransition from '$components/PageTransition.svelte'
import ShopHeader from '$components/organisms/ShopHeader.svelte'
import PostersGrid from '$components/organisms/PostersGrid.svelte'
export let status: number
const { posters } = getContext('shop')
const errors = {
404: {
title: 'Product not found',
message: 'The product you are looking for does not exist… yet!',
},
500: {
title: 'Server error',
message: "That is embarassing, the problem is on our side.",
},
}
</script>
<Metas
title="{errors[status].title} Houses Of"
/>
<PageTransition name="shop-page">
<ShopHeader />
<section class="shop-page__error">
<div class="container grid">
<div class="inner">
<h2 class="title-big">Uh oh!</h2>
<p class="text-medium">{errors[status].message}</p>
</div>
</div>
</section>
<PostersGrid {posters} />
</PageTransition>
<script context="module" lang="ts">
import type { LoadEvent, LoadOutput } from '@sveltejs/kit'
export async function load ({ fetch, status }: LoadEvent): Promise<LoadOutput> {
console.log(status)
return {
props: {
status,
},
}
}
</script>