refactored more error code
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user