code cleanup

This commit is contained in:
2025-07-30 15:35:19 +02:00
parent 631a527a5d
commit fccec9865a
27 changed files with 442 additions and 428 deletions

View File

@@ -1,19 +1,19 @@
<script>
import { onMount } from 'svelte';
import { onMount } from 'svelte';
import { useTinyRouter } from 'svelte-tiny-router';
import { t } from '../../translations.svelte.js';
import { api } from '../../urls.svelte.js';
import { api } from '../../urls.svelte.js';
import { t } from '../../translations.svelte.js';
import TaskList from './TaskList.svelte';
import LineEditor from '../../Components/LineEditor.svelte';
import TaskList from './TaskList.svelte';
import LineEditor from '../../Components/LineEditor.svelte';
const router = useTinyRouter();
let { estimated_time, show_closed, task } = $props();
let children = $state(null);
let error = $state(null);
let start = 0;
let deleted = $state(false);
let deleted = $state(false);
let error = $state(null);
const router = useTinyRouter();
let start = 0;
function addSubtask(){
router.navigate(`/task/${task.id}/add_subtask`);
@@ -21,10 +21,10 @@
async function deleteTask(){
if (confirm(t('confirm_delete',{element:task.name}))){
const url = api(`task/${task.id}`);
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials:'include',
method:'DELETE'
credentials : 'include',
method : 'DELETE'
});
if (resp.ok){
deleted = true;
@@ -35,20 +35,20 @@
}
async function loadChildren(){
const url = api('task/list');
var data = {
parent_task_id:+task.id,
show_closed: show_closed
const url = api('task/list');
const data = {
parent_task_id : +task.id,
show_closed : show_closed
};
if (task.show_closed) data.show_closed = true;
const resp = await fetch(url,{
credentials:'include',
method:'POST',
body:JSON.stringify(data)
credentials : 'include',
method : 'POST',
body : JSON.stringify(data)
});
if (resp.ok){
children = await resp.json();
error = null;
error = null;
} else {
error = await resp.text();
}
@@ -59,11 +59,11 @@
}
async function patchTask(changeset){
const url = api(`task/${task.id}`);
const url = api(`task/${task.id}`);
const resp = await fetch(url,{
credentials:'include',
method: 'PATCH',
body: JSON.stringify(changeset)
credentials : 'include',
method : 'PATCH',
body : JSON.stringify(changeset)
});
if (resp.ok){
task = await resp.json();