import { browser } from '$app/env';
const internals = {
+ kVersion: '1:', // in case we need to force a re-fetch
kHost: import.meta.env.VITE_PUBLIC_BASE_PATH || 'http://localhost:3000',
kDataPrefix: '/data/',
kAdjectivesPath: '/adjectives.json',
const shortLocale = locale.split('-')[0];
const targetFile = internals.kHost + internals.kDataPrefix + shortLocale + path;
- const data = browser && localStorage.getItem(targetFile);
+ const data = browser && localStorage.getItem(internals.kVersion + targetFile);
if (data) {
return JSON.parse(data);
}
let newData = await (await fetch(targetFile)).json();
- browser && localStorage.setItem(targetFile, JSON.stringify(newData));
+ browser && localStorage.setItem(internals.kVersion + targetFile, JSON.stringify(newData));
return newData;
},