From 8a62e7dbaeeffb6dff533c7000aba51a5c85e479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Chopin?= Date: Wed, 20 Mar 2024 16:22:00 +0100 Subject: [PATCH] docs: update tasks return value --- docs/1.guide/10.tasks.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/1.guide/10.tasks.md b/docs/1.guide/10.tasks.md index 26def03421..0a6b33afd9 100644 --- a/docs/1.guide/10.tasks.md +++ b/docs/1.guide/10.tasks.md @@ -51,7 +51,7 @@ export default defineTask({ }, run({ payload, context }) { console.log("Running DB migration task..."); - return "Success"; + return { result: "Success" }; }, }); ``` @@ -108,6 +108,7 @@ export default eventHandler(async (event) => { // IMPORTANT: Authenticate user and validate payload! const payload = { ...getQuery(event) }; const { result } = await runTask("db:migrate", { payload }); + return { result }; }); ``` @@ -157,7 +158,7 @@ export default defineTask({ }, run({ payload, context }) { console.log("Running echo task..."); - return payload; + return { result: payload }; }, }); ```