Skip to content

Commit

Permalink
Merge pull request #440 from ertush/hotfix
Browse files Browse the repository at this point in the history
Added Update to Facility Type details field to facility Upgrade and D…
  • Loading branch information
ertush authored Aug 7, 2024
2 parents bea16e2 + c41e2cf commit 7523949
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 40 deletions.
11 changes: 5 additions & 6 deletions pages/facilities/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ const queryId = zSchema.parse(ctx.query).id
})
.then((r) => r.json())
.then(async (json) => {
allOptions["data"] = json
allOptions["data"] = json ?? null


// fetch ward boundaries
Expand All @@ -926,10 +926,9 @@ const queryId = zSchema.parse(ctx.query).id

_data = await response.json();

const [lng, lat] =
_data?.ward_boundary.properties.center.coordinates;
const [lng, lat] = _data?.ward_boundary.properties.center.coordinates ?? null;

allOptions["geoLocation"] = JSON.parse(JSON.stringify(_data?.ward_boundary));
allOptions["geoLocation"] = JSON.parse(JSON.stringify(_data?.ward_boundary)) ?? null;
allOptions["center"] = [lat, lng];

} catch (e) {
Expand All @@ -949,7 +948,7 @@ const queryId = zSchema.parse(ctx.query).id
}
)).json()

allOptions["updates"] = facilityUpdateData
allOptions["updates"] = facilityUpdateData ?? null


}
Expand All @@ -967,7 +966,7 @@ const queryId = zSchema.parse(ctx.query).id
}
})

allOptions["activityLog"] = (await resp.json()).revisions
allOptions["activityLog"] = (await resp.json())?.revisions ?? null

}
catch (e) {
Expand Down
2 changes: 2 additions & 0 deletions pages/facilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ export async function getServerSideProps(ctx) {
url = `${url}&page=${ctx.query.page}`
}

console.log({url})


try {
facilities = (await (await fetch(url, {
Expand Down
Loading

0 comments on commit 7523949

Please sign in to comment.