refactored more error code
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { api, target } from '../../urls.svelte.js';
|
||||
import { error, yikes } from '../../warn.svelte';
|
||||
import { t } from '../../translations.svelte.js';
|
||||
|
||||
let {
|
||||
@@ -9,7 +10,6 @@
|
||||
onSelect = (time) => {}
|
||||
} = $props();
|
||||
|
||||
let error = $state(null);
|
||||
let projects = $state(null);
|
||||
let times = $state(null);
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
});
|
||||
if (resp.ok){
|
||||
projects = await resp.json();
|
||||
yikes();
|
||||
} else {
|
||||
error = await resp.body();
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +40,7 @@
|
||||
if (resp.ok){
|
||||
times = await resp.json();
|
||||
} else {
|
||||
error = await resp.body();
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user