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