Update save convert to check when to reload
parent
309f50a5ab
commit
d165d8161e
|
@ -71,6 +71,7 @@ const convertSave = async () => {
|
||||||
const converted = localStorage.getItem(CONVERTED_KEY);
|
const converted = localStorage.getItem(CONVERTED_KEY);
|
||||||
if (converted !== null) return;
|
if (converted !== null) return;
|
||||||
|
|
||||||
|
let convertedCount = 0;
|
||||||
for (const [key, value] of Object.entries(localStorage)) {
|
for (const [key, value] of Object.entries(localStorage)) {
|
||||||
if (key.endsWith('ar') || key.endsWith('wl')) {
|
if (key.endsWith('ar') || key.endsWith('wl')) {
|
||||||
await localforage.setItem(key, Number(value));
|
await localforage.setItem(key, Number(value));
|
||||||
|
@ -94,10 +95,17 @@ const convertSave = async () => {
|
||||||
} else {
|
} else {
|
||||||
await localforage.setItem(key, JSON.parse(value));
|
await localforage.setItem(key, JSON.parse(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!key.endsWith('locale')) {
|
||||||
|
convertedCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
localStorage.setItem(CONVERTED_KEY, dayjs().toISOString());
|
localStorage.setItem(CONVERTED_KEY, dayjs().toISOString());
|
||||||
|
|
||||||
|
if (convertedCount > 0) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkLocalSave = async () => {
|
export const checkLocalSave = async () => {
|
||||||
|
|
Loading…
Reference in New Issue