diff --git a/src/components/molecules/ChallengeHeader.tsx/index.tsx b/src/components/molecules/ChallengeHeader.tsx/index.tsx index de77dc9b..1c02f73b 100644 --- a/src/components/molecules/ChallengeHeader.tsx/index.tsx +++ b/src/components/molecules/ChallengeHeader.tsx/index.tsx @@ -55,7 +55,7 @@ function ChallengeHeader({ const [selectedCategory, setSelectedCategory] = useState('전체'); const [keyword, setKeyword] = useState(''); const [booleanMine, setBooleanMine] = useState(false); - const [ismine, setIsmine] = useState(1); + const [ismine, setIsmine] = useState(0); const [userStateNum, setUserState] = useState(userStatusData ? userStatusData.userType : 0); const getChallengeCategoryData = useCallback( diff --git a/src/components/molecules/Loginform/index.tsx b/src/components/molecules/Loginform/index.tsx index 18974799..5e78332b 100644 --- a/src/components/molecules/Loginform/index.tsx +++ b/src/components/molecules/Loginform/index.tsx @@ -87,7 +87,7 @@ function Loginform(): React.ReactElement { { diff --git a/src/components/molecules/ViewListCard/index.tsx b/src/components/molecules/ViewListCard/index.tsx index 759bb9a3..c4c3431c 100644 --- a/src/components/molecules/ViewListCard/index.tsx +++ b/src/components/molecules/ViewListCard/index.tsx @@ -98,6 +98,7 @@ function ViewListCard({ const [userStateNickname, setUserStateNickname] = useState(userData ? userData.nickname : 0); const [isMine, setIsMine] = useState(false); const [likeRender, setLikeRender] = useState(isLike); + const [scrapRender, setScrapRender] = useState(isScrap); const getCommentList = useCallback(async () => { if (userStatusData) { @@ -152,14 +153,20 @@ function ViewListCard({ const submitScarp = async () => { if (userStatusData) { const token = userStatusData.token; - await ChallengeScrap(token, id); + const submitSuccess = await ChallengeScrap(token, id); + if (submitSuccess) { + setScrapRender(true); + } } }; const cancelScrap = async () => { if (userStatusData) { const token = userStatusData.token; - await CancelChallengeScrap(token, id); + const cancelSuccess = await CancelChallengeScrap(token, id); + if (cancelSuccess) { + setScrapRender(false); + } } }; @@ -184,7 +191,7 @@ function ViewListCard({

{dayjs(createdAt).format('MM.DD')}

{userStateNum === 0 || userStateNum === 1 || userStateNum === 2 || isMine === false ? ( - isScrap === false ? ( + scrapRender === false ? (