From 99e36f6b70540b20edf8ec1ab86fbf4422cc61d6 Mon Sep 17 00:00:00 2001 From: BennettLiam Date: Mon, 2 Sep 2024 15:32:01 +0100 Subject: [PATCH] Update +server.ts --- .../svelte/optimistic-updates/src/routes/api/data/+server.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts b/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts index 46bfe05612..96db577a78 100644 --- a/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts +++ b/examples/svelte/optimistic-updates/src/routes/api/data/+server.ts @@ -19,8 +19,9 @@ export const POST: RequestHandler = async ({ request }) => { const { text } = await request.json() if (Math.random() > 0.7) { - json({ message: 'Could not add item!' }, { status: 500 }) + return json({ message: 'Could not add item!' }, { status: 500 }) } + const newTodo = { id: Math.random().toString(), text: text.toUpperCase() as string,