working on tak use list

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-07-30 22:15:41 +02:00
parent 166e65d369
commit a3723138c1
6 changed files with 45 additions and 6 deletions

View File

@@ -62,7 +62,7 @@
<Route path="/project/:id/kanban" component={Kanban} />
<Route path="/project/:id/view" component={ViewPrj} />
<Route path="/search" component={Search} />
<Route path="/tags/use/:tag" component={TagUses} />
<Route path="/tags/use/:tag" component={TagUses} />
<Route path="/task/:parent_task_id/add_subtask" component={AddTask} />
<Route path="/task/:id/view" component={ViewTask} />
<Route path="/user" component={User} />

View File

@@ -7,19 +7,24 @@
let { tag } = $props();
let error = $state(null);
let router = useTinyRouter();
let uses = $state(null);
async function loadUses(){
const url = api(`tags/uses/${tag}`);
const resp = await fetch(api,{credentials:'include'});
const resp = await fetch(url,{credentials:'include'});
if (resp.ok){
uses = await resp.json;
uses = await resp.json();
error = null;
} else {
error = await resp.text();
}
}
function go(module,id){
router.navigate(`/${module}/${id}/view`);
}
onMount(loadUses);
</script>
<fieldset>
@@ -27,4 +32,12 @@
{#if error}
<span class="error">{error}</span>
{/if}
{#if uses}
{#each Object.entries(uses) as [module,ids]}
<h2>{t(module)}</h2>
{#each ids as id}
<button onclick={() => go(module,id)}>{t(module)} {id}</button>
{/each}
{/each}
{/if}
</fieldset>