implemented loading of accounts
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -1,14 +1,28 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { useTinyRouter } from 'svelte-tiny-router';
|
||||
import { t } from '../../translations.svelte';
|
||||
import { api, get } from '../../urls.svelte';
|
||||
import { error, yikes } from '../../warn.svelte';
|
||||
|
||||
const router = useTinyRouter();
|
||||
|
||||
let accounts = [];
|
||||
|
||||
async function load(){
|
||||
let url = api('accounting');
|
||||
let res = await get(url);
|
||||
if (res.ok){
|
||||
yikes();
|
||||
accounts = await res.json();
|
||||
} else error(res);
|
||||
}
|
||||
|
||||
function newAccount(){
|
||||
router.navigate('/accounting/new');
|
||||
}
|
||||
|
||||
|
||||
onMount(load);
|
||||
</script>
|
||||
|
||||
<fieldset>
|
||||
|
||||
Reference in New Issue
Block a user