From 0f502332018dddd0cc403ae3852da2e9009f7718 Mon Sep 17 00:00:00 2001 From: eric Date: Tue, 16 Jan 2024 09:43:38 +0300 Subject: [PATCH] Fixed community units edit page --- pages/community-units/edit/[id].js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/community-units/edit/[id].js b/pages/community-units/edit/[id].js index 0ac8f511..738f1637 100644 --- a/pages/community-units/edit/[id].js +++ b/pages/community-units/edit/[id].js @@ -72,7 +72,7 @@ export async function getServerSideProps({req, res, query}) { for( let option of options){ switch(option){ - case "cu": + case "cu":getServerSideProps const cu = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/chul/units/${query.id}/`,{ headers:{ 'Authorization': 'Bearer ' + token, @@ -99,8 +99,8 @@ export async function getServerSideProps({req, res, query}) { case "facilities": - const count = await getFacilityCount(token) - + getFacilityCount(token) + .then(async ({count}) => { const facilities = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facilities/?page_size=${count ?? '500'}&fields=id,name,county,sub_county_name,constituency,ward_name`,{ headers:{ 'Authorization': 'Bearer ' + token, @@ -110,6 +110,8 @@ export async function getServerSideProps({req, res, query}) { }) response["facilities"] = (await (await facilities.json()))?.results?.map(({ id, name }) => ({ label: name, value: id })) + + }) break; case "contact_types":