Fix utf-8 decoding

This commit is contained in:
shamoon 2024-02-01 00:39:25 -08:00
parent 390b02fa2c
commit a5ec0249f8

View File

@ -12,7 +12,8 @@ export default async function cachedFetch(url, duration) {
return cached;
}
const data = await fetch(url).then((res) => res.json());
// wrapping text in JSON.parse to handle utf-8 issues
const data = JSON.parse(await fetch(url).then((res) => res.text()));
cache.put(url, data, duration * 1000 * 60);
return data;
}