Skip to content

Commit

Permalink
Merge pull request #484 from ertush/hotfix
Browse files Browse the repository at this point in the history
Hotfix: Changed the CU facility options to filter by sub_county
  • Loading branch information
ertush authored Sep 11, 2024
2 parents addd3db + 6473301 commit fed5f1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pages/community-units/edit/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function getServerSideProps(ctx) {
.then(resp => resp.json())
.then((resp) => {

const params = `?ward=${resp?.results[0].id}&fields=id,name,county,sub_county_name,constituency,ward_name&page_size=150`
const params = `?sub_county=${resp?.results[0].id}&fields=id,name,county,sub_county_name,constituency,ward_name&page_size=150`

return fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facilities/${params}&reporting_in_dhis=true&closed=false`, { /*&owner_type=6a833136-5f50-46d9-b1f9-5f961a42249f*/
headers: {
Expand Down Expand Up @@ -127,7 +127,7 @@ export async function getServerSideProps(ctx) {

case "facilities":

const url = `${process.env.NEXT_PUBLIC_API_URL}/common/wards/?name=${response?.cu?.facility_ward.split(' ').join('+')}`
const url = `${process.env.NEXT_PUBLIC_API_URL}/common/sub_counties/?name=${response?.cu?.facility_subcounty.split(' ').join('+')}`

response['facilities'] = await fetchFacilities(url)

Expand Down
15 changes: 12 additions & 3 deletions pages/public/facilities/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function FacilityDetails(props) {
return (
<>
<Head>
<title>KMHFR | {facility?.official_name ?? ""}</title>
<title>KMHFR </title>
<link rel="icon" href="/favicon.ico" />

</Head>
Expand Down Expand Up @@ -175,6 +175,12 @@ function FacilityDetails(props) {


FacilityDetails.getInitialProps = async (ctx) => {


ctx?.res?.setHeader(
'Cache-Control',
'no-cache, no-store, max-age=0'
)

const allOptions = {};

Expand Down Expand Up @@ -213,8 +219,11 @@ FacilityDetails.getInitialProps = async (ctx) => {
"/";
return await fetch(url, {
headers: {
Authorization: "Bearer " + token,
Accept: "application/json",
'Accept': 'application/json, text/plain, */*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Authorization': `Bearer ${token}`,
'Accept-Language': 'en-US,en;q=0.5',
'Cache-Control': 'no-cache, no-store, max-age=0'
},
})
.then((r) => r.json())
Expand Down
2 changes: 1 addition & 1 deletion pages/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function Users (props) {
return (
<div className="">
<Head>
<title>KMHFR | Reports</title>
<title>KMHFR | Users</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<MainLayout isLoading={false} isFullWidth={false}>
Expand Down

0 comments on commit fed5f1f

Please sign in to comment.