-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] 마이페이지에서 챌린지 이동 시 url undefined 오류 수정 #132
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const jsonString = challenge.title.replaceAll("'", '"'); | ||
const jsonObject = JSON.parse(jsonString); | ||
return ( | ||
<CardContainer | ||
key={challenge._id} | ||
onClick={() => { | ||
handleChallengeClick(challenge.channel._id, challenge._id); | ||
handleChallengeClick( | ||
challenge.channel as unknown as string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as unknown as string
는 어떤 의미인가요...? 결국 string 타입이라는 뜻일까요..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
말씀해주신 뜻이 맞습니다! challege가 Post
interface를 따라서 channel이라는 속성이 Channel
interface를 갖고 있는데, 바로 as string으로는 형변환이 안되고 unknown으로 한 번 바꿔주고 string으로 바꿔줘야 하더라구요.. 썩 좋은 방법은 아닌 거 같지만 당장 문제는 해결돼서 일단 이렇게 수정했었습니다
@@ -18,6 +17,7 @@ const UserInfo = styled.div` | |||
const MyProfilePage = () => { | |||
const [myUser] = useAtom(userAtom); | |||
usePageTitle(myUser.fullName); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의미없는 파일이 커밋에 반영된것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsx return 하는 곳이랑 딱 붙어 있어서 한 줄 띄웠던 거로 기억합니다!
📌 기능 설명
챌린지 url 오류 수정
👩💻 요구 사항과 구현 내용
MyProfilePage에서 MyChallenges 컴포넌트를 이용하여 내 챌린지들을 보여주는데, 이때 클릭 시 channel id가 제대로 반영되지 않던 오류를 수정했습니다. 이제부터 정상적으로 접근하여 잔디 심기가 가능합니다.
구현 결과