Make request identical to real requests

This commit is contained in:
2024-04-27 14:05:08 -07:00
parent 776b0afdab
commit d4c8835e9b
2 changed files with 11 additions and 3 deletions

View File

@@ -206,8 +206,16 @@ async function getConsulates() {
}
async function getAvailableDates(consulateId) {
let uri = window.location.pathname + `/days/${consulateId}.json?appointments[expedite]=false`
let dates = fetch(uri, { headers: { "x-requested-with": "XMLHttpRequest" }})
let addressUri = window.location.pathname + `/address/${consulateId}`
fetch(addressUri, { headers: { "x-requested-with": "XMLHttpRequest" } })
.catch(error => console.error('Error:', error));
let datesUri = window.location.pathname + `/days/${consulateId}.json?appointments[expedite]=false`
let dates = fetch(datesUri, { headers: {
"x-requested-with": "XMLHttpRequest",
"accept": "application/json, text/javascript, */*; q=0.01",
// "cache-control": "no-cache",
}})
.then(d => d.json())
.catch(async e => {
await handleHttpError(e);