mirror of
https://github.com/cupcakearmy/svelte-rest-demo.git
synced 2026-04-02 09:55:30 +00:00
client
This commit is contained in:
18
client/src/routes/todo/[id].svelte
Normal file
18
client/src/routes/todo/[id].svelte
Normal file
@@ -0,0 +1,18 @@
|
||||
<script context="module">
|
||||
export async function preload(page, session) {
|
||||
return page.params
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
import Todo from '../../components/Todo.svelte'
|
||||
import { todos } from '../../api'
|
||||
|
||||
export let id
|
||||
|
||||
$: todo = $todos.find(todo => todo._id === id)
|
||||
</script>
|
||||
|
||||
{#if todo}
|
||||
<Todo {todo} />
|
||||
{/if}
|
||||
Reference in New Issue
Block a user