diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-01 20:09:47 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2023-01-01 20:09:47 -0500 |
| commit | b24748777294b3646e67c4b7e599e032ee1dfcf9 (patch) | |
| tree | f30debd3dcdeca6d35fdb551a22ab94eb3b9c46d /ui/src/routes/list | |
| parent | fa6f3d619e6051d508d9f40c601f77f9b05e1784 (diff) | |
| download | paste-b24748777294b3646e67c4b7e599e032ee1dfcf9.tar.gz paste-b24748777294b3646e67c4b7e599e032ee1dfcf9.tar.xz | |
Start of Svelte UI
Diffstat (limited to 'ui/src/routes/list')
| -rw-r--r-- | ui/src/routes/list/+page.js | 14 | ||||
| -rw-r--r-- | ui/src/routes/list/+page.svelte | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/ui/src/routes/list/+page.js b/ui/src/routes/list/+page.js new file mode 100644 index 0000000..72e2878 --- /dev/null +++ b/ui/src/routes/list/+page.js @@ -0,0 +1,14 @@ + + + + +/** @type {import('./$types').PageLoad} */ +export async function load({ params }) { + const req = await fetch(`http://localhost:6130/api/v1/list`) + const reqJson = await req.json(); + + return { + req: req, + reqJson: reqJson, + }; +}
\ No newline at end of file diff --git a/ui/src/routes/list/+page.svelte b/ui/src/routes/list/+page.svelte new file mode 100644 index 0000000..c487068 --- /dev/null +++ b/ui/src/routes/list/+page.svelte @@ -0,0 +1,22 @@ +<script> + + + let data = null; + + const req = fetch(`http://localhost:6130/api/v1/list`) + .then((res) => res.json()) + .then(resData => data = resData); + +</script> + +{#if data} +<ul> + {#each data as paste (paste.id)} + <li> + <a href="/view/{paste.id}"> + ID: {paste.id} ({paste.size} bytes) + </a> + </li> + {/each} +</ul> +{/if}
\ No newline at end of file |
