Skip to content

Commit

Permalink
test using proper fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
vhargrave committed Mar 6, 2024
1 parent 47b16c9 commit bd51b96
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions libs/features/georoutingv2/georoutingv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,17 @@ const getAkamaiCode = () => new Promise((resolve, reject) => {
resolve(akamaiLocale.toLowerCase());
} else {
/* c8 ignore next 5 */
geo2jsonp((data) => {
const code = data.country.toLowerCase();
sessionStorage.setItem('akamai', code);
resolve(code);
}, reject);
fetch('https://geo2.adobe.com/json/').then((resp) => {
if (resp.ok) {
resp.json().then((data) => {
const code = data.country.toLowerCase();
sessionStorage.setItem('akamai', code);
resolve(code);
});
}
}).catch(() => {
reject(new Error('Failed to get akamai code'));
});
}
});

Expand Down

0 comments on commit bd51b96

Please sign in to comment.