From b66fb4a629f6e01bd5423aac18a5a8011f4985bf Mon Sep 17 00:00:00 2001 From: amel Date: Mon, 23 Dec 2024 10:47:51 +0800 Subject: [PATCH] fix: api Deskripsi: - update api yang pake filter idgrup, ketika idgrup='' No Issues --- src/app/api/division/route.ts | 2 +- src/app/api/position/route.ts | 2 +- src/app/api/project/route.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/api/division/route.ts b/src/app/api/division/route.ts index 44b61a4..855b32e 100644 --- a/src/app/api/division/route.ts +++ b/src/app/api/division/route.ts @@ -23,7 +23,7 @@ export async function GET(request: Request) { const active = searchParams.get("active"); const dataSkip = Number(page) * 10 - 10; - if (idGroup == "null" || idGroup == undefined) { + if (idGroup == "null" || idGroup == undefined || idGroup == "") { grup = user.idGroup } else { grup = idGroup diff --git a/src/app/api/position/route.ts b/src/app/api/position/route.ts index 4d12dfa..1f4723d 100644 --- a/src/app/api/position/route.ts +++ b/src/app/api/position/route.ts @@ -19,7 +19,7 @@ export async function GET(request: Request) { return NextResponse.json({ success: false, message: "Anda harus login untuk mengakses ini" }, { status: 401 }); } - if (idGroup == "null" || idGroup == undefined) { + if (idGroup == "null" || idGroup == undefined || idGroup == "") { grup = user.idGroup } else { grup = idGroup diff --git a/src/app/api/project/route.ts b/src/app/api/project/route.ts index be6eb0e..a0632ed 100644 --- a/src/app/api/project/route.ts +++ b/src/app/api/project/route.ts @@ -24,7 +24,7 @@ export async function GET(request: Request) { const villageId = user.idVillage const userId = user.id - if (idGroup == "null" || idGroup == undefined) { + if (idGroup == "null" || idGroup == undefined || idGroup == "") { grup = user.idGroup } else { grup = idGroup