Skip to content

Commit

Permalink
Merge pull request #51 from JangAyeon/qa
Browse files Browse the repository at this point in the history
QA: 방문모드 및 나의섬 분리 이후 아이템 정보 재요청 버그 수정 반영
  • Loading branch information
JangAyeon authored Mar 2, 2024
2 parents 965a0d0 + 04211af commit 9544dd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion components/forms/VisitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const VisitForm = () => {

const visitFriend = () => {
// 브라우저 url에 사용자 Email, name 노출 안되게
router.push(`/visit?id=${friendEmail}&name=${friendName}`, "/visit")
router.push(`/visit?id=${friendEmail}&name=${friendName}`)
}

const checkValidEmail = async (e: FormEvent<HTMLFormElement>) => {
Expand Down
23 changes: 10 additions & 13 deletions pages/island/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,29 @@ import Island from "@/components/pages/island"

import useIsland from "@/hooks/useIsland"

import { getItemExist, getItemsLoc, getType } from "@/utils/island"
import {
getIslandInfo,
getItemExist,
getItemsLoc,
getType,
} from "@/utils/island"

const Myland = () => {
const { islandType, islandItemExist } = useIsland()
const {
query: { id },
query: { id, name },
} = useRouter()
const [isLoading, setIsLoading] = useState(true)
const getIslandInfo = useCallback(async () => {
if (id) {
// 현재 서버에 저장된 섬타입, 아이템 위치, 아이템 소유목록 dispatch
console.log("현재 저장된 섬 정보 불러오기", id)
getType(id as User["email"])
getItemsLoc(id as User["email"])
getItemExist(id as User["email"])
}
}, [id])

const stopLoading = async () => {
await new Promise((resolve) => setTimeout(resolve, 3000))
setIsLoading(false)
}

useEffect(() => {
setIsLoading(true)
getIslandInfo()
}, [getIslandInfo])
getIslandInfo(id as User["email"])
}, [id, name])

useEffect(() => {
if (isLoading && islandItemExist) {
Expand Down
9 changes: 8 additions & 1 deletion pages/visit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,21 @@ import { getIslandInfo } from "@/utils/island"
const Island = () => {
const [isLoading, setIsLoading] = useState(false)
const { islandType, islandItemExist } = useIsland()
const router = useRouter()
const {
query: { id, name },
} = useRouter()
} = router
const stopLoading = async () => {
await new Promise((resolve) => setTimeout(resolve, 3000))
setIsLoading(false)
}

useEffect(() => {
setIsLoading(true)
if (id && name) {
getIslandInfo(id as User["email"])
}
}, [id, name])
useEffect(() => {
if (isLoading && islandItemExist) {
console.log("stop")
Expand Down

0 comments on commit 9544dd7

Please sign in to comment.