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

View File

@ -2,10 +2,14 @@
import type { PageProps } from "./$types"; import type { PageProps } from "./$types";
let { data }: PageProps = $props(); let { data }: PageProps = $props();
const task = data.task.tasks[0];
</script> </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"> <div class="container">
<p><strong>{task.status}</strong></p> <p><strong>{task.status}</strong></p>
<p><strong>{task.priority}</strong></p> <p><strong>{task.priority}</strong></p>
@ -14,6 +18,16 @@
<h2>Body</h2> <h2>Body</h2>
<p>{task.body}</p> <p>{task.body}</p>
</div> </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> <style>
.container { .container {