2 changed files with 30 additions and 1 deletions
@ -1,7 +1,32 @@ |
|||||||
<script> |
<script> |
||||||
|
import { t } from '../../translations.svelte.js'; |
||||||
|
import { onMount } from 'svelte'; |
||||||
|
|
||||||
|
let { company_id, onSelect = (time) => {} } = $props(); |
||||||
|
|
||||||
|
let times = $state(null); |
||||||
|
let error = $state(null); |
||||||
|
|
||||||
|
async function loadTimes(){ |
||||||
|
const url = `${location.protocol}//${location.host.replace('5173','8080')}/api/times/list`; |
||||||
|
let data = { company_id: company_id }; |
||||||
|
const resp = await fetch(url,{ |
||||||
|
credentials:'include', |
||||||
|
method: 'POST', |
||||||
|
body: JSON.stringify(data) |
||||||
|
}); |
||||||
|
if (resp.ok){ |
||||||
|
times = await resp.json(); |
||||||
|
} else { |
||||||
|
error = await resp.body(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
onMount(loadTimes); |
||||||
</script> |
</script> |
||||||
|
|
||||||
<div> |
<div> |
||||||
<h1>Times</h1> |
<h1>Times</h1> |
||||||
|
{#if times} |
||||||
|
{/if} |
||||||
</div> |
</div> |
||||||
Loading…
Reference in new issue