Probably fixed 401 error
This commit is contained in:
parent
6af70c07bc
commit
17bc09d67e
@ -254,11 +254,11 @@ async function getAvailableDates(consulateId) {
|
||||
"accept": "application/json, text/javascript, */*; q=0.01",
|
||||
// "cache-control": "no-cache",
|
||||
}})
|
||||
.then(d => d.json())
|
||||
.catch(async e => {
|
||||
await handleHttpError(e);
|
||||
throw e;
|
||||
})
|
||||
.then(d => d.json())
|
||||
.then(data => {
|
||||
let dateList = data.map(item => item.date);
|
||||
dateList.sort();
|
||||
@ -279,12 +279,12 @@ async function filterDates(dates, currentAppt, deltaFromAppt, deltaFromNow) {
|
||||
|
||||
async function getAvailableTimes(consulateId, date) {
|
||||
let uri = window.location.pathname + `/times/${consulateId}.json?date=${date}&appointments[expedite]=false`
|
||||
let times = await fetch(uri, { headers: { "x-requested-with": "XMLHttpRequest" } })
|
||||
.then(d => d.json())
|
||||
let times = fetch(uri, { headers: { "x-requested-with": "XMLHttpRequest" } })
|
||||
.catch(async e => {
|
||||
await handleHttpError(e);
|
||||
throw e;
|
||||
})
|
||||
.then(d => d.json())
|
||||
.then(data => data.available_times)
|
||||
.catch(e => null);
|
||||
return times;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user