mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-27 06:47:31 +03:00
fix auth args (#1376)
This commit is contained in:
parent
60653fb835
commit
cc2b13ade2
@ -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,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -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 }
|
||||
})
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user