From f3c7c522b697f8dc3af80f05bd3cb7d3f7b5af32 Mon Sep 17 00:00:00 2001 From: Edoardo Ranghieri Date: Sun, 1 Oct 2023 23:51:31 +0200 Subject: [PATCH] refactor(example): update context example with `middleware` --- packages/example-app/src/app/with-context/edituser-action.ts | 2 +- packages/example-app/src/lib/safe-action.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/example-app/src/app/with-context/edituser-action.ts b/packages/example-app/src/app/with-context/edituser-action.ts index 3f44bcc6..0a89b3ae 100644 --- a/packages/example-app/src/app/with-context/edituser-action.ts +++ b/packages/example-app/src/app/with-context/edituser-action.ts @@ -13,7 +13,7 @@ export const editUser = authAction( // Here you have access to `userId`, which comes from `buildContext` // return object in src/lib/safe-action.ts. // \\\\\ - async ({ fullName, age }, { userId }) => { + async ({ fullName, age }, userId) => { if (fullName.toLowerCase() === "john doe") { return { error: { diff --git a/packages/example-app/src/lib/safe-action.ts b/packages/example-app/src/lib/safe-action.ts index 6f5b05e0..fed343de 100644 --- a/packages/example-app/src/lib/safe-action.ts +++ b/packages/example-app/src/lib/safe-action.ts @@ -17,9 +17,5 @@ export const authAction = createSafeActionClient({ const userId = randomUUID(); console.log("HELLO FROM ACTION MIDDLEWARE, USER ID:", userId); - - return { - userId, - }; }, });