API routes now return proper Responses and basic errors are handled
slight improvements in layouting
This commit is contained in:
15
src/routes/rezepte/+layout.svelte
Normal file
15
src/routes/rezepte/+layout.svelte
Normal file
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
import Header from '$lib/components/Header.svelte'
|
||||
|
||||
</script>
|
||||
|
||||
<Header>
|
||||
<ul class=site_header slot=links>
|
||||
<li><a href="/">Home</a></li>
|
||||
<li><a href="/rezepte">Alle Rezepte</a></li>
|
||||
<li><a href="/rezepte/season">In Saison</a></li>
|
||||
<li><a href="/rezepte/category">Nach Kategorie</a></li>
|
||||
<li><a href="/rezepte/tag">Stichwörter</a></li>
|
||||
</ul>
|
||||
<slot></slot>
|
||||
</Header>
|
@ -89,12 +89,13 @@ h1{
|
||||
|
||||
.wrapper_wrapper{
|
||||
background-color: #fbf9f3;
|
||||
width: 100svw;
|
||||
padding-top: 3rem;
|
||||
padding-top: 10rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 3rem;
|
||||
transform: translateY(-7rem);
|
||||
z-index: -2;
|
||||
}
|
||||
|
||||
.wrapper{
|
||||
@ -118,7 +119,7 @@ h1{
|
||||
background-color: var(--nord6);
|
||||
padding: 1rem 2rem;
|
||||
translate: 0 1px; /*bruh*/
|
||||
z-index: -1;
|
||||
z-index: 1;
|
||||
}
|
||||
.icon{
|
||||
position: absolute;
|
||||
@ -185,22 +186,13 @@ h4{
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<!--<MultiImgWrapper wrap={data.images.length>1} class=double>
|
||||
{#each data.images as img}
|
||||
<img width=100% src="/images/{img.mediapath}" alt="{img.alt}">
|
||||
<figure>
|
||||
{#if img.caption}
|
||||
<caption>{img.caption}</caption>
|
||||
{/if}
|
||||
</figure>
|
||||
{/each}
|
||||
</MultiImgWrapper>-->
|
||||
|
||||
<TitleImgParallax src=/images/{data.images[0].mediapath}>
|
||||
<div class=title>
|
||||
<a class="icon" href='/rezepte/season/{data.season[0]}'>{data.icon}</a>
|
||||
<h1>{data.name}</h1>
|
||||
{#if data.description && ! data.preamble}
|
||||
<p>{data.description}</p>
|
||||
{/if}
|
||||
{#if data.preamble}
|
||||
<p>{data.preamble}</p>
|
||||
{/if}
|
||||
|
@ -126,7 +126,17 @@
|
||||
bearer: password,
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
if(res.status === 200){
|
||||
const url = location.href.split('/')
|
||||
url.splice(url.length -1, 1);
|
||||
url.push(short_name)
|
||||
location.assign(url.join('/'))
|
||||
}
|
||||
else{
|
||||
const item = await res.json();
|
||||
alert(item.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,15 @@
|
||||
})
|
||||
|
||||
})
|
||||
if(res.status === 200){
|
||||
const url = location.href.split('/')
|
||||
url.splice(url.length -2, 2);
|
||||
location.assign(url.join('/'))
|
||||
}
|
||||
else{
|
||||
const item = await res.json();
|
||||
alert(item.message)
|
||||
}
|
||||
}
|
||||
async function doEdit() {
|
||||
const res = await fetch('/api/edit', {
|
||||
@ -124,7 +133,15 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
const item = await res.json();
|
||||
if(res.status === 200){
|
||||
const url = location.href.split('/');
|
||||
url.splice(url.length -2, 1);
|
||||
location.assign(url.join('/'))
|
||||
}
|
||||
else{
|
||||
const item = await res.json()
|
||||
alert(item.message)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user