diff --git a/pages/map/index.js b/pages/map/index.js index 87a6349..b15c84a 100644 --- a/pages/map/index.js +++ b/pages/map/index.js @@ -9,16 +9,32 @@ export default function Map() { const router = useRouter(); const [dusts, setDusts] = useState([]); - //API호출 (getDustAPI) + const [isCatchSuccess, setIsCatchSuccess] = useState(false); + + let count = 0; + const onCatchChange = () => { + setIsCatchSuccess((prev) => !prev); + }; + const getDustsAPI = async () => { const response = await getDusts("SSU"); - console.log(response); if (response.status == 200) { if (response.data.code == 200) { setDusts(response.data.result.dustInfo); } } + + console.log(response); + for (let i = 0; i < 5; i++) { + if (response.data.result.dustInfo[i].caught == true) { + count++; + } + } + if (count == 5) { + onCatchChange(); + console.log(count); + } }; const startTimerAPI = async () => { @@ -49,6 +65,13 @@ export default function Map() { return ( <> + {isCatchSuccess && ( +
+ 미션 +
+ 컴플릿뜨 +
+ )}
diff --git a/styles/Map.module.css b/styles/Map.module.css index 03f15d5..b6dcd3b 100644 --- a/styles/Map.module.css +++ b/styles/Map.module.css @@ -1,3 +1,20 @@ +.complete { + font-family: "NeoDunggeunmo"; + font-size: 30px; + z-index: 3; + text-align: center; + justify-content: center; + align-items: center; + width: 100vw; + height: 100vh; + color: #ffffff; + background: rgba(45, 45, 45, 0.3); + position: absolute; + display: flex; + justify-content: center; + align-items: center; +} + .map { min-height: 100vh; max-width: 100vh;