Skip to content

Commit

Permalink
refactor(example): update context example with middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdoRan committed Oct 1, 2023
1 parent 116da1d commit f3c7c52
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 0 additions & 4 deletions packages/example-app/src/lib/safe-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@ export const authAction = createSafeActionClient({
const userId = randomUUID();

console.log("HELLO FROM ACTION MIDDLEWARE, USER ID:", userId);

return {
userId,
};
},
});

0 comments on commit f3c7c52

Please sign in to comment.