diff --git a/src/pages/resources/[id]/edit.tsx b/src/pages/resources/[id]/edit.tsx index d1d09e7..2be936b 100644 --- a/src/pages/resources/[id]/edit.tsx +++ b/src/pages/resources/[id]/edit.tsx @@ -59,7 +59,6 @@ const EditResourcePage = ( }); const onSubmit: SubmitHandler = (data) => { - console.log("mutating"); mutate(data); }; diff --git a/src/server/api/routers/auditoryResources.ts b/src/server/api/routers/auditoryResources.ts index 293bd76..fa6c614 100644 --- a/src/server/api/routers/auditoryResources.ts +++ b/src/server/api/routers/auditoryResources.ts @@ -60,14 +60,17 @@ export const auditoryResourceRouter = createTRPCRouter({ .optional(), }) ) - .mutation(({ input, ctx }) => { - console.log(input); - // return await ctx.prisma.auditoryResource.update({ - // where: { - // id: input.id, - // }, - // data: { ...input }, - // }); + .mutation(async ({ input, ctx }) => { + return await ctx.prisma.auditoryResource.update({ + where: { + id: input.id, + }, + data: Object.fromEntries( + Object.entries(input).filter(([key, _value]) => { + return key !== "id"; + }) + ), + }); }), search: publicProcedure