Implement changes from TaskService.

This commit is contained in:
themodrnhakr 2025-09-29 21:13:26 -05:00
parent 5bc27f6061
commit 9c219054d3
2 changed files with 60 additions and 46 deletions

View File

@ -4,8 +4,8 @@
let { data }: PageProps = $props();
</script>
{#if data.tasks.status === "ok" && data.tasks.tasks !== undefined}
<p>{data.tasks.tasks.length} total records.</p>
{#if data.tasks.status === "ok" && data.tasks.data !== undefined}
<p>{data.tasks.data.length} total records.</p>
<table>
<thead>
<tr>
@ -15,14 +15,14 @@
</tr>
</thead>
<tbody>
{#each data.tasks.tasks as task (task.id)}
{#each data.tasks.data as task (task.id)}
<tr>
<td>
<a
href={`/tasks/${task.type.prefix}${task.taskId}`}
>
{task.type?.prefix +
task.taskId}
<a href={`/tasks/${task.type.prefix}${task.taskId}`}>
{
task.type?.prefix
+ task.taskId
}
</a>
</td>
<td>{task.description}</td>

View File

@ -2,10 +2,14 @@
import type { PageProps } from "./$types";
let { data }: PageProps = $props();
const task = data.task.tasks[0];
</script>
<h1>{`[[${task.type.prefix}${task.taskId}]] - ${task.description}`}</h1>
{#if data.task.status === "ok"}
{@const task = data.task.data[0]}
{#if task}
<h1>
{`[[${task.type.prefix}${task.taskId}]] - ${task.description}`}
</h1>
<div class="container">
<p><strong>{task.status}</strong></p>
<p><strong>{task.priority}</strong></p>
@ -14,6 +18,16 @@
<h2>Body</h2>
<p>{task.body}</p>
</div>
{:else}
<p>Task not found.</p>
{/if}
{:else if data.task.status === "failure"}
<h2>Error Loading Task</h2>
<p>{data.task.error}</p>
{#if data.task.code}
<p>Error code: {data.task.code}</p>
{/if}
{/if}
<style>
.container {