40 lines
887 B
Svelte
40 lines
887 B
Svelte
<script context="module">
|
|
import { getWork } from '$lib/works';
|
|
|
|
export async function load({ params }) {
|
|
return {
|
|
props: {
|
|
cid: params.cid,
|
|
},
|
|
};
|
|
}
|
|
</script>
|
|
|
|
<script>
|
|
import { goto } from '$app/navigation';
|
|
|
|
import { user } from '$lib/stores/user';
|
|
import CategoryAdmin from '$lib/components/CategoryAdmin.svelte';
|
|
import { Category, getCategory } from '$lib/categories';
|
|
|
|
export let cid;
|
|
|
|
let categoryP = null;
|
|
$: {
|
|
categoryP = getCategory(cid);
|
|
}
|
|
</script>
|
|
|
|
{#await categoryP then category}
|
|
<div class="d-flex align-items-center">
|
|
<h2>
|
|
<a href="categories/" class="text-muted" style="text-decoration: none"><</a>
|
|
{category.label}
|
|
</h2>
|
|
</div>
|
|
|
|
{#if $user && $user.is_admin}
|
|
<CategoryAdmin {category} on:saved={(e) => { goto(`categories/`)}} />
|
|
{/if}
|
|
{/await}
|