Skip to content
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

Merged
merged 1 commit into from
Jul 1, 2022

Conversation

chogyejin
Copy link
Member

📌 기능 설명

챌린지 url 오류 수정

👩‍💻 요구 사항과 구현 내용

MyProfilePage에서 MyChallenges 컴포넌트를 이용하여 내 챌린지들을 보여주는데, 이때 클릭 시 channel id가 제대로 반영되지 않던 오류를 수정했습니다. 이제부터 정상적으로 접근하여 잔디 심기가 가능합니다.

구현 결과

@vercel
Copy link

vercel bot commented Jun 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
shallenge ✅ Ready (Inspect) Visit Preview Jun 29, 2022 at 5:47AM (UTC)

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,
Copy link
Member

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 타입이라는 뜻일까요..

Copy link
Member Author

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);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의미없는 파일이 커밋에 반영된것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsx return 하는 곳이랑 딱 붙어 있어서 한 줄 띄웠던 거로 기억합니다!

@sa02045 sa02045 self-requested a review June 29, 2022 10:52
@chogyejin chogyejin merged commit 3bb7d8d into main Jul 1, 2022
@chogyejin chogyejin deleted the fix/my-profile branch July 10, 2022 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants