Add route to view a single task.
This commit is contained in:
parent
8c0970a19a
commit
e41f651e00
9
src/routes/tasks/[task_id]/+page.server.ts
Normal file
9
src/routes/tasks/[task_id]/+page.server.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import TasksService from "$lib/server/services/tasks";
|
||||||
|
import type { PageServerData } from "./$types";
|
||||||
|
|
||||||
|
export const load: PageServerData = async ({ params }) => {
|
||||||
|
const tasks = new TasksService("internal");
|
||||||
|
return {
|
||||||
|
task: await tasks.getByTaskId([params.task_id]),
|
||||||
|
};
|
||||||
|
};
|
||||||
23
src/routes/tasks/[task_id]/+page.svelte
Normal file
23
src/routes/tasks/[task_id]/+page.svelte
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
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>
|
||||||
|
<div class="container">
|
||||||
|
<p><strong>{task.status}</strong></p>
|
||||||
|
<p><strong>{task.priority}</strong></p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2>Body</h2>
|
||||||
|
<p>{task.body}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user