mirror of
https://github.com/vinliao/nashboard-old.git
synced 2025-12-17 04:35:15 +01:00
connect front to back
This commit is contained in:
@@ -1,4 +1,19 @@
|
|||||||
|
<script context="module">
|
||||||
|
export async function load({ fetch }) {
|
||||||
|
const response = await fetch("/api/data");
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
return {
|
||||||
|
status: response.status,
|
||||||
|
props: {
|
||||||
|
data: data
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
export let data;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Welcome to SvelteKit</h1>
|
<h1>Welcome to SvelteKit</h1>
|
||||||
@@ -7,3 +22,4 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="underline">hello from branch</p>
|
<p class="underline">hello from branch</p>
|
||||||
|
<pre>{JSON.stringify(data)}</pre>
|
||||||
|
|||||||
Reference in New Issue
Block a user