From 17bc09d67e8e44b5883cc4d99b9616db099fc704 Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Sat, 27 Apr 2024 22:48:50 -0700 Subject: [PATCH] Probably fixed 401 error --- scripts/content.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/content.js b/scripts/content.js index 5e67275..d51788e 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -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;