From 3865049731a08c5403cd647dc00332a5b861a29a Mon Sep 17 00:00:00 2001 From: eric Date: Fri, 25 Oct 2024 15:29:14 +0300 Subject: [PATCH] Updated the router push link for approveRejectFacility handler --- .gitignore | 3 +++ components/Forms/BasicDetailsForm.js | 7 ++++--- controllers/facility/approveRejectFacility.js | 3 ++- next.config.js | 10 ++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9d76adc..242404a 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ todo.md /test-results/ /playwright-report/ /playwright/.cache/ + +# pages +pages/test-fetch.js diff --git a/components/Forms/BasicDetailsForm.js b/components/Forms/BasicDetailsForm.js index d7fcb26..18a1e6e 100644 --- a/components/Forms/BasicDetailsForm.js +++ b/components/Forms/BasicDetailsForm.js @@ -563,11 +563,12 @@ export function BasicDeatilsForm({ editMode }) { if (facilityData) { fetch( - `${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}`, + `${process.env.NEXT_PUBLIC_API_URL}/common/wards/${facilityData?.ward}/`, { headers: { - Authorization: 'Bearer ' + options?.token, - Accept: 'application/json', + 'Accept': 'application/json', + 'Content-Type': 'application/json;charset=UTF-8', + 'Authorization': `Bearer ${options?.token}` } } ) diff --git a/controllers/facility/approveRejectFacility.js b/controllers/facility/approveRejectFacility.js index 9af5e4f..74c21e1 100644 --- a/controllers/facility/approveRejectFacility.js +++ b/controllers/facility/approveRejectFacility.js @@ -104,7 +104,8 @@ function approveRejectFacility (facility_id, comment, alert, reject, token, setS router.push({ pathname: '/facilities', query: { - to_publish: true, + filter: pending_approval_facilities, + to_publish: false, closed: false } }) diff --git a/next.config.js b/next.config.js index 18ea052..9c912ad 100644 --- a/next.config.js +++ b/next.config.js @@ -115,6 +115,16 @@ const nextConfig = { }, ], }, + // For debug only + { + source: '/test-fetch', + headers: [ + { + key: 'Cache-Control', + value: 'no-cache, no-store, max-age=0' + }, + ], + }, ] }