Skip to content

Commit

Permalink
fix propagate on delete not working
Browse files Browse the repository at this point in the history
  • Loading branch information
willianba committed Jun 23, 2024
1 parent b3d8815 commit cc497d5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions routes/api/expenses/[id].ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const UpdateExpenseSchema = z.object({
});

const DeleteExpenseSchema = z.object({
propagate: z
.string()
.optional()
.transform((v) => v === "true"),
propagate: z.boolean().optional().default(false),
});

export const handler: Handlers<ExpenseWithoutUser, SignedInState> = {
Expand Down Expand Up @@ -67,7 +64,7 @@ export const handler: Handlers<ExpenseWithoutUser, SignedInState> = {
return Response.json(updatedExpense, { status: 200 });
},
async DELETE(req, ctx) {
const data = DeleteExpenseSchema.parse(req.body);
const data = DeleteExpenseSchema.parse(await req.json());

logger.info("Deleting expense");

Expand Down

0 comments on commit cc497d5

Please sign in to comment.