fix auth args (#1376)

This commit is contained in:
vincanger 2023-07-31 10:23:53 +02:00 committed by GitHub
parent 60653fb835
commit cc2b13ade2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -67,11 +67,11 @@ Let's now define the Action's JavaScript implementation in `src/server/actions.t
```js title="src/server/actions.js"
// ...
export const updateTask = async ({ id, isDone }, context) => {
export const updateTask = async (args, context) => {
return context.entities.Task.update({
where: { id },
where: { args.id },
data: {
isDone: isDone,
isDone: args.isDone,
},
})
}
@ -89,13 +89,13 @@ import { CreateTask, UpdateTask } from "@wasp/actions/types"
type UpdateTaskPayload = Pick<Task, "id" | "isDone">
export const updateTask: UpdateTask<UpdateTaskPayload, Task> = async (
{ id, isDone },
args,
context
) => {
return context.entities.Task.update({
where: { id },
where: { args.id },
data: {
isDone: isDone,
isDone: args.isDone,
},
})
}

View File

@ -382,15 +382,15 @@ export const createTask: CreateTask<CreateTaskPayload, Task> = async (
type UpdateTaskPayload = Pick<Task, "id" | "isDone">
export const updateTask: UpdateTask<UpdateTaskPayload, { count: number }> = async (
{ id, isDone },
args,
context
) => {
if (!context.user) {
throw new HttpError(401)
}
return context.entities.Task.updateMany({
where: { id: args.taskId, user: { id: context.user.id } },
data: { isDone: args.data.isDone }
where: { id: args.id, user: { id: context.user.id } },
data: { isDone: args.isDone }
})
}
```