update update successful toast

This commit is contained in:
Zhang Minghan 2023-10-04 10:41:54 +08:00
parent af2e1ef3d7
commit c9aa30b160
3 changed files with 19 additions and 2 deletions

View File

@ -22,6 +22,17 @@ function ReloadPrompt() {
},
});
const before = localStorage.getItem('version') || '';
if (before.length > 0 && before !== version) {
toast({
title: t('service.update-success'),
description: t('service.update-success-prompt'),
})
console.debug(`[service] service worker updated (from ${before} to ${version})`);
}
localStorage.setItem('version', version);
useEffect(() => {
if (offlineReady) {
toast({
@ -44,7 +55,7 @@ function ReloadPrompt() {
setOfflineReady(false);
setNeedRefresh(false);
}
}, []);
}, [offlineReady, needRefresh]);
return <></>;
}

View File

@ -1,6 +1,6 @@
import axios from "axios";
export const version: string = "3.2.3";
export const version = "3.2.4";
export const deploy: boolean = true;
export let rest_api: string = "http://localhost:8094";
export let ws_api: string = "ws://localhost:8094";

View File

@ -168,6 +168,8 @@ const resources = {
"update": "Update",
"offline-title": "Offline Mode",
"offline": "App is currently offline.",
"update-success": "Update Success",
"update-success-prompt": "You have been updated to the latest version.",
}
},
},
@ -323,6 +325,8 @@ const resources = {
"update": "更新",
"offline-title": "离线模式",
"offline": "应用当前处于离线状态。",
"update-success": "更新成功",
"update-success-prompt": "您已更新至最新版本。",
}
},
},
@ -489,6 +493,8 @@ const resources = {
"update": "Обновить",
"offline-title": "Режим оффлайн",
"offline": "Приложение в настоящее время находится в автономном режиме.",
"update-success": "Обновление успешно",
"update-success-prompt": "Вы обновились до последней версии.",
}
},
},