feat: 새로운 설문조사 등록시 갱신에서 안내

This commit is contained in:
2023-03-09 02:20:27 +09:00
parent 1d477a285a
commit 86576d4852
+25
View File
@@ -238,6 +238,19 @@ function moveLobby() {
location.replace("../");
}
const lastVoteState = (() => {
const key = `state.${serverID}.lastVote`;
const value = parseInt(localStorage.getItem(key) ?? "0");
const obj = ref<number>(value);
watch(obj, (newValue, oldValue) => {
if(newValue == oldValue){
return;
}
localStorage.setItem(key, newValue.toString());
});
return obj;
})();
async function tryRefresh() {
msgPanel.value?.tryRefresh();
@@ -403,6 +416,18 @@ watch(refreshCounter, async () => {
title: "갱신 완료",
});
}
const lastVoteID = response.global.lastVoteID;
if (lastVoteID > lastVoteState.value) {
lastVoteState.value = lastVoteID;
toasts.warning({
title: "설문조사 안내",
body: `새로운 설문조사가 있습니다.`,
}, {
delay: 1000 * 60,
});
}
} catch (e) {
generalInfoLock = false;
console.error(e);