diff --git a/views/myPage/AnswerVideos.tsx b/views/myPage/AnswerVideos.tsx index 9d75ef7..f374f1d 100644 --- a/views/myPage/AnswerVideos.tsx +++ b/views/myPage/AnswerVideos.tsx @@ -10,12 +10,13 @@ const AnswerVideos = () => { const answerRes = useInfiniteQuery( [queryKey.myAnswer], async ({ pageParam = 1 }) => { - const res = (await getMyAnswerList(pageParam, 10)).data.data + const res = (await getMyAnswerList(pageParam, 10)).data.data; return { page: pageParam, data: res }; }, { getNextPageParam: (lastPage) => lastPage.page + 1, + retry: 0, }, ); @@ -27,13 +28,17 @@ const AnswerVideos = () => { ); useEffect(() => { - if (inView) { + if (inView && !answerRes.isError) { answerRes.fetchNextPage(); } }, [answerRes, inView]); const a = 1; + if (answerRes.isLoading) { + return
loading..
; + } + return (
@@ -50,6 +55,7 @@ const AnswerVideos = () => { views={v.views} /> ))} +
); diff --git a/views/myPage/QuestionVideos.tsx b/views/myPage/QuestionVideos.tsx index 41ac42e..c4c7566 100644 --- a/views/myPage/QuestionVideos.tsx +++ b/views/myPage/QuestionVideos.tsx @@ -1,6 +1,6 @@ import styled from "@emotion/styled"; import { VideoItem } from "@views/myPage"; -import { isError, useInfiniteQuery } from "react-query"; +import { useInfiniteQuery } from "react-query"; import queryKey from "@constants/queryKey"; import { getMyQuesionList } from "@apis/myPage"; import { useInView } from "react-intersection-observer"; @@ -16,6 +16,7 @@ const QuestionVideos = () => { }, { getNextPageParam: (lastPage) => lastPage.page + 1, + retry: 0, }, ); @@ -38,10 +39,6 @@ const QuestionVideos = () => { return
loading..
; } - // if (questionRes.isError) { - // return
Error.
; - // } - return (