From a65410af79b0aba22c21925876386adcfc2f825d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Wed, 17 Jan 2024 16:11:41 +0100 Subject: [PATCH 1/2] fix: added missing "?" --- app/attachment/[id]/route.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/attachment/[id]/route.tsx b/app/attachment/[id]/route.tsx index 4bb82d2..b153845 100644 --- a/app/attachment/[id]/route.tsx +++ b/app/attachment/[id]/route.tsx @@ -4,7 +4,7 @@ import { notFound } from 'next/navigation'; export async function GET(request: Request, { params:{ id } }: { params: { id:string } }) { const [locationID, billID] = id.split('-'); - const [location, bill] = await fetchBillById(locationID, billID) ? []; + const [location, bill] = await fetchBillById(locationID, billID) ?? []; if(!bill?.attachment) { notFound(); From 48990701c960fddfe5cbe6d61ef100c82788aaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Wed, 17 Jan 2024 16:17:43 +0100 Subject: [PATCH 2/2] locationAction didn't allways return form state --- app/lib/actions/locationActions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/lib/actions/locationActions.ts b/app/lib/actions/locationActions.ts index a928f1e..36fadb9 100644 --- a/app/lib/actions/locationActions.ts +++ b/app/lib/actions/locationActions.ts @@ -7,6 +7,7 @@ import { ObjectId } from 'mongodb'; import { withUser } from '@/app/lib/auth'; import { AuthenticatedUser } from '../types/next-auth'; import { gotoHome } from './navigationActions'; +import { Noto_Sans_Tamil_Supplement } from 'next/font/google'; export type State = { errors?: { @@ -14,7 +15,7 @@ export type State = { locationNotes?: string[], }; message?:string | null; -} +}; const FormSchema = z.object({ _id: z.string(), @@ -81,6 +82,11 @@ export const updateOrAddLocation = withUser(async (user:AuthenticatedUser, locat } await gotoHome(yearMonth ? `/?year=${yearMonth?.year}` : undefined) + + return { + message: null, + errors: undefined, + }; });