Skip to content

Commit c75a994

Browse files
Fix svelte optimistic updates example (#8005)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
1 parent 0a35234 commit c75a994

File tree

1 file changed

+2
-1
lines changed
  • examples/svelte/optimistic-updates/src/routes/api/data

1 file changed

+2
-1
lines changed

examples/svelte/optimistic-updates/src/routes/api/data/+server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export const POST: RequestHandler = async ({ request }) => {
1919
const { text } = await request.json()
2020

2121
if (Math.random() > 0.7) {
22-
json({ message: 'Could not add item!' }, { status: 500 })
22+
return json({ message: 'Could not add item!' }, { status: 500 })
2323
}
24+
2425
const newTodo = {
2526
id: Math.random().toString(),
2627
text: text.toUpperCase() as string,

0 commit comments

Comments
 (0)