diff --git a/hwe/ts/PageFront.vue b/hwe/ts/PageFront.vue index 78ecc249..8e4cbb5c 100644 --- a/hwe/ts/PageFront.vue +++ b/hwe/ts/PageFront.vue @@ -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(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);