Skip to content

Commit 4bed794

Browse files
committed
show data
1 parent 11da7f5 commit 4bed794

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/routes/+page.svelte

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<script lang="ts">
2+
import type { Customer } from '$lib/server/db';
23
import { runQuery } from '$lib/sqlite/dataApi';
34
import { waitTillStroageReady } from '$lib/sqlite/initStorages';
45
import { onMount } from 'svelte';
56
67
let storageReady = false;
8+
let customers: Customer[] = [];
79
810
onMount(async () => {
911
await waitTillStroageReady('customers_v1');
1012
storageReady = true;
11-
const data = await runQuery(`update customers_v1 set company = 'xyz' where 1 = 1`);
12-
console.log(data);
13-
const data2 = await runQuery('SELECT * FROM customers_v1 limit 10');
14-
console.log(data2);
13+
customers = (await runQuery('SELECT * FROM customers_v1 limit 10')) as Customer[];
14+
console.log(customers);
1515
});
1616
</script>
1717

@@ -20,3 +20,11 @@
2020
<div>
2121
Storage Ready: {storageReady ? 'true' : 'false'}
2222
</div>
23+
24+
<div>
25+
{#each customers as customer}
26+
<div>
27+
{customer.company}: Contact: {customer.contact} - {customer.phone}
28+
</div>
29+
{/each}
30+
</div>

0 commit comments

Comments
 (0)