From 86576d4852971f3911d1998c770bf8eb32dd91a5 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Thu, 9 Mar 2023 01:51:57 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=83=88=EB=A1=9C=EC=9A=B4=20=EC=84=A4?= =?UTF-8?q?=EB=AC=B8=EC=A1=B0=EC=82=AC=20=EB=93=B1=EB=A1=9D=EC=8B=9C=20?= =?UTF-8?q?=EA=B0=B1=EC=8B=A0=EC=97=90=EC=84=9C=20=EC=95=88=EB=82=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/PageFront.vue | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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);