Skip to content

Commit

Permalink
Merge pull request #554 from ertush/fallback-for-facilities-page-fix
Browse files Browse the repository at this point in the history
Fix: getServerSideProps of facilities/index.js
  • Loading branch information
ertush authored Nov 21, 2024
2 parents 295df00 + 413c67e commit 8f23afd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pages/facilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1500,13 +1500,17 @@ export async function getServerSideProps(ctx) {

if (userGroup === 1) { // CHRIO

const userCountyID = user?.county
url = `${url}&county=${userCountyID}`
if(!url.includes("&county")) {
const userCountyID = user?.county
url = `${url}&county=${userCountyID}`
}

} else if (userGroup === 2) { // SCHRIO

const userSubCountyIDs = user?.user_sub_counties.length > 1 ? user?.user_sub_counties.map(({sub_county}) => sub_county)?.join(',') : user?.user_sub_counties[0]?.sub_county
url = `${url}&sub_county=${userSubCountyIDs}`
if(!url.includes("&sub_county")) {
const userSubCountyIDs = user?.user_sub_counties.length > 1 ? user?.user_sub_counties.map(({sub_county}) => sub_county)?.join(',') : user?.user_sub_counties[0]?.sub_county
url = `${url}&sub_county=${userSubCountyIDs}`
}

}

Expand Down

0 comments on commit 8f23afd

Please sign in to comment.