Skip to content

Commit

Permalink
Merge pull request #514 from ertush/hotfix
Browse files Browse the repository at this point in the history
Updated facilities/[id].js
  • Loading branch information
ertush authored Oct 22, 2024
2 parents 3a41906 + 9643e57 commit 8fd5569
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions pages/facilities/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,13 @@ function Facility(props) {


export async function getServerSideProps(ctx) {

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


const allOptions = {};

const zSchema = z.object({
Expand Down Expand Up @@ -906,8 +913,12 @@ const queryId = zSchema.parse(ctx.query).id
`${process.env.NEXT_PUBLIC_API_URL}/common/wards/${json.ward}/`,
{
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',
'Connection': 'keep-alive'
},
}
);
Expand All @@ -930,8 +941,12 @@ const queryId = zSchema.parse(ctx.query).id
const facilityUpdateData = await (await fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facility_updates/${json.latest_update}/`,
{
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',
'Connection': 'keep-alive'
},
}
)).json()
Expand All @@ -949,8 +964,12 @@ const queryId = zSchema.parse(ctx.query).id
try {
const resp = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/facilities/facilities/${json?.id}/?fields=__rev__&include_audit=true`, {
headers: {
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
'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',
'Connection': 'keep-alive'
}
})

Expand Down

0 comments on commit 8fd5569

Please sign in to comment.