Open History to see the last commit
1<script lang="ts">
2 import { resolve } from '$app/paths'
3 import { createQuery } from '@tanstack/svelte-query'
4 import { postQueryOptions } from './queries'
5β
6 const { postId }: { postId: number } = $props()
7β
8 const post = createQuery(() => postQueryOptions(postId))
9</script>
10β
11<div>
12 <div>
13 <a class="button" href={resolve('/')}> Back </a>
14 </div>
15 {#if !postId || post.isPending}
16 <span>Loading...</span>
17 {/if}
18 {#if post.error}
19 <span>Error: {post.error.message}</span>
20 {/if}
21 {#if post.isSuccess}
22 <h1>{post.data.title}</h1>
23 <div>
24 <p>{post.data.body}</p>
25 </div>
26 <div>{post.isFetching ? 'Background Updating...' : ' '}</div>
27 {/if}
28</div>