wirking on global error display

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-09-26 14:45:19 +02:00
parent 9c4c71f7dd
commit 2a6392cd2b
14 changed files with 113 additions and 116 deletions

View File

@@ -2,8 +2,9 @@
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
import { api } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
import { timetrack } from '../../user.svelte.js';
import { now } from '../../time.svelte';
@@ -19,7 +20,6 @@
let { id } = $props();
let children = $state(null);
let dummy = $derived(updateOn(id));
let error = $state(null);
let estimated_time = $state({sum:0});
let project = $state(null);
const router = useTinyRouter();
@@ -47,8 +47,9 @@
if (resp.ok) {
const track = await resp.json();
timetrack.running = track;
yikes();
} else {
error = await resp.text();
error(await resp.text());
}
}
@@ -87,9 +88,9 @@
});
if (resp.ok){
children = await resp.json();
error = null;
yikes();
} else {
error = await resp.text();
error(await resp.text());
}
}
@@ -99,7 +100,7 @@
if (resp.ok){
task.parent = await resp.json();
} else {
error = await resp.text();
error(await resp.text());
}
}
@@ -108,14 +109,14 @@
const resp = await fetch(url,{credentials:'include'});
if (resp.ok){
task = await resp.json();
error = null;
yikes();
project = null;
children = null;
loadChildren();
if (task.project_id) loadProject();
if (task.parent_task_id) loadParent();
} else {
error = await resp.text();
error(await resp.text());
}
}
@@ -124,9 +125,9 @@
const resp = await fetch(url,{credentials:'include'});
if (resp.ok){
project = await resp.json();
error = null;
yikes();
} else {
error = await resp.text();
error(await resp.text());
}
}
@@ -142,13 +143,13 @@
body : JSON.stringify(data)
});
if (resp.ok){
error = null;
yikes();
let old_task = task;
task = await resp.json();
if (task.parent_id == old_task.parent_id) task.parent = old_task.parent;
return true;
} else {
error = await resp.text();
error(await resp.text());
return false;
}
}
@@ -177,9 +178,6 @@
<title>Umbrella {t('task')}: {task?.name}</title>
</svelte:head>
{#if error}
<span class="error">{error}</span>
{/if}
{#if task}
<div class={`task grid2 prio_${task.total_prio} p${Math.floor(task.total_prio/10)*10} p${task.total_prio % 10}`} >
{#if project}