refactored more error code

This commit is contained in:
2025-09-26 21:10:19 +02:00
parent e3b735bb7b
commit 2463f92b1c
23 changed files with 111 additions and 173 deletions

View File

@@ -3,6 +3,7 @@
import { useTinyRouter } from 'svelte-tiny-router';
import { api } from '../../urls.svelte.js';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte.js';
import { user } from '../../user.svelte.js';
@@ -11,7 +12,6 @@
import Tags from '../tags/TagList.svelte';
let { project_id = null, parent_task_id } = $props();
let error = $state(null);
let project = $state(null);
let extendedSettings = $state(false);
let parent_task = $state(null);
@@ -54,10 +54,10 @@
parent_task = await resp.json();
task.parent_task_id = +parent_task_id;
project_id = parent_task.project_id;
error = null;
yikes();
project = null; // TODO
} else {
error = await resp.text();
error(resp);
}
}
@@ -67,9 +67,9 @@
if (resp.ok){
project = await resp.json();
task.project_id = +project_id;
error = null;
yikes();
} else {
error = await resp.text();
error(resp);
}
}
@@ -111,9 +111,9 @@
if (task.parent_task_id){
router.navigate(`/task/${task.parent_task_id}/view`);
} else router.navigate(`/task/${task.id}/view`);
error = null;
yikes();
} else {
error = await resp.text();
error(resp);
}
}
@@ -130,9 +130,6 @@
<fieldset>
<legend>{t('add_object',{object:t('task')})}</legend>
{#if error}
<span class="error">{error}</span>
{/if}
<table {onkeydown}>
<tbody>
<tr>