preparing item service for use in document service
This commit is contained in:
@@ -1,7 +1,26 @@
|
||||
<script>
|
||||
import { t } from '../../translations.svelte.js';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let items = $state(null);
|
||||
let error = $state(null);
|
||||
async function loadItems(){
|
||||
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/items/list`;
|
||||
const resp = await fetch(url,{credentials:'include'});
|
||||
if (resp.ok){
|
||||
items = await resp.json();
|
||||
} else {
|
||||
error = await resp.body();
|
||||
}
|
||||
}
|
||||
|
||||
onMount(loadItems);
|
||||
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<h1>Items</h1>
|
||||
{#if error}
|
||||
<span class="error">{error}</span>
|
||||
{/if}
|
||||
</div>
|
||||
Reference in New Issue
Block a user