Open History to see the last commit
1<script lang="ts">
2 import { createQuery } from '../createQuery'
3 import type { QueryClient } from '@tanstack/query-core'
4 import type { CreateQueryOptions } from '../types'
5β
6 export let options: CreateQueryOptions<any>
7 export let queryClient: QueryClient
8β
9 const query = createQuery(options, queryClient)
10</script>
11β
12{#if $query.isPending}
13 <p>Loading</p>
14{:else if $query.isError}
15 <p>Error</p>
16{:else if $query.isSuccess}
17 {#if Array.isArray($query.data)}
18 {#each $query.data as item}
19 <p>{item}</p>
20 {/each}
21 {:else}
22 <p>{$query.data}</p>
23 {/if}
24{/if}