-
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
[Feature/#50] detail community api #57
base: develop
Are you sure you want to change the base?
Conversation
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.
๊ถ๊ธํ ๋ถ๋ถ์ ๋ํ ๋ฆฌ๋ทฐ ์์ฑํ์ต๋๋ค ๐
์๊ณ ๋ง์ผ์
จ์ด์~~!
@@ -39,7 +39,7 @@ const router = createBrowserRouter([ | |||
element: <CommunityPage />, | |||
}, | |||
{ | |||
path: '/detail/community/:id', | |||
path: '/community/post/:id', |
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.
writing page์์๋ ์์ ํ ๊ฒ์~!!
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.
๋ด!! ์ ๋ api ํ์๊ณผ ๋น์ทํ๊ฒ ๋ฐ๊ฟ๋จ์ด์ ๐๐ป
import axios from 'axios'; | ||
import { useState } from 'react'; | ||
|
||
interface CommentInputProps { |
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.
์ปจ๋ฒค์
์ ๋ฐ๋ผ CommentInputPropTypes
๋ก ์์ ํ์
์ผ ํ ๊ฒ ๊ฐ์์!
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.
์์ด๊ตฌ์ผ ์๊พธ ๋์น๋ค์!! ใ ใ ใ ๋ฐ์ํด๋๊ฒ ์ต๋๋น ใ ใ ๊ฐ์ฌํด์
|
||
const { data, refetch } = useQuery({ | ||
queryKey: ['post', id], | ||
queryFn: () => getDetailPost(Number(id)), |
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.
queryFn ๋ด๋ถ์ ์ฐ์ง ์๊ณ ๋ค๋ฅธ ํจ์๋ก ๋ถ๋ฆฌํ ์ด์ ๊ฐ ์์ผ์ ๊ฐ์?
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.
๊ฐ๋ ์ฑ๋๋ฌธ์ ๋ถ๋ฆฌํ์ต๋๋ค! ์ถ๊ฐ์ ์ผ๋ก api ๊ด๋ จ ๋ก์ง์ ๋ถ๋ฆฌํ๋ฉด ์ด๋์ ๋ ์ญํ ๋ ๋ถ๋ฆฌ๋๊ณ ๊ด๋ จ ์์ธ์ฒ๋ฆฌ ์์๋ ์ ์ฉํ ๊ฒ ๊ฐ๋ค ์๊ฐํ์ต๋๋ค ใ ใ ใ
user_info: UserDataType; | ||
} | ||
|
||
export interface PostContentPropTypes { |
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.
์ ๋ ์ฝ๋๋ฅผ ์์ฑํ ๋ propTypes์ ๊ฒฝ์ฐ, ํด๋น ์ปดํฌ๋ํธ ๋ด๋ถ์ ์ฌ์ฉํ๋ ํธ์ด ๋ฐ๋ก ์ดํดํ ์ ์์ด ์ปดํฌ๋ํธ ๋ด๋ถ์ ๋๋ ํธ์
๋๋ค.
type์ ๋ฐ๋ก ๋ถ๋ฆฌํ์ ์ด์ ๋ ํ์ผ์ ๋ชจ์๋๊ธฐ ์ํจ์ผ๊น์?
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.
์ ๊ฐ์ ๊ฒฝ์ฐ๋ ๊ด๋ จ๋ type์ด ์ ์ ๋์ด๋์ ๊ฐ๋ ์ฑ ์ธก๋ฉด ๋๋ฌธ์ ๋ถ๋ฆฌํด๋์ต๋๋ค!
๐ ๊ณผ์ ์ค๋ช
๊ฒ์๋ฌผ ์์ธ ์กฐํ ํ์ด์ง ๊ตฌํ
๐ฉโ๐ป ์๊ตฌ ์ฌํญ๊ณผ ๊ตฌํ ๋ด์ฉ
โ PR ํฌ์ธํธ & ๊ถ๊ธํ ์
DetailPostContent.tsx
์์ likesCount๊ฐ ์์ผ๋ฉด 0์ผ๋ก ์ค์ ํด์ค ์ดํ๋ก, ํ ๊ธ์ ๊ฐ์ ๋ฐ์์ํค๊ธฐ ์ํดuseEffect
๋ฅผ ์ผ๋๋ฐ์,, ๋ ์ข์ ๋ฐฉ๋ฒ์ด ์์์ง ๊ณ ๋ฏผ์ด ๋ฉ๋๋ค ใ ใClose #50