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

Feature/#42 #44

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Feature/#42 #44

wants to merge 6 commits into from

Conversation

00kang
Copy link
Collaborator

@00kang 00kang commented Sep 8, 2022

이슈 넘버

[#42] 4-9. 게시글 불러오기

요약

변경 내용 설명

index.jsx에서 getArticleFeed() 보충
ArticleFeed.jsx 생성
Home.jsx 생성

@00kang 00kang marked this pull request as draft September 8, 2022 15:12
@00kang 00kang requested review from thejsw and gomjellie and removed request for thejsw September 8, 2022 15:12
Comment on lines 20 to 30
{author}
</a>
<span className="date">{createdAt}</span>
</div>
<button className="btn btn-outline-primary btn-sm pull-xs-right">
<i className="ion-heart"></i> {favoritesCount}
</button>
</div>
<a href="" className="preview-link">
<h1>{title}</h1>
<p>{description}</p>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

home.jsx에서 articlefeed 내용만 따로 분리했습니다.
api 데이터가 필요한 부분을 {~~}으로 바꿨습니다.

Comment on lines 10 to 14
useEffect(() => {
getArticleFeed((limit: 20), (offset: 0)).then((res) => {
const data = res.data.article;
});
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

userEffect()로 렌더링 되자마자 getArticleFeed()가 실행되도록 했습니다.
swagger ui를 보면 limit은 20, offset은 0으로 default값이 설정되어 있는데, 이를 어떻게 해야할지 모르겠습니다.

Copy link
Member

Choose a reason for hiding this comment

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

page 를 url 에 param으로 갖도록하고 이를 파싱해서 이용해보세요.
offeset: page *20 으로 주면 될것으로 보이네요 @00kang

Copy link
Member

Choose a reason for hiding this comment

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

useEffect는 2번째 인자로 deps 배열을 받도록 되어있습니다~ 한번 react useEffect관련 문서를 살펴보시길 바랍니다.

Comment on lines 43 to 55
{data.map(() => {
return (
<ArticleFeed
author={data.author}
createdAt={data.createdAt}
description={data.description}
favoritesCount={data.favoritesCount}
slug={data.slug}
title={data.title}
updatedAt={data.updatedAt}
/>
);
})}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

articlefeed.jsx에 사용될 데이터들을 정리했습니다.

@@ -71,7 +72,7 @@ const conduitAxios = axios.create({
*/
const postUsersLogin = (user) =>
conduitAxios.post(`/users/login`, {
data: { email: user.email, password: user.password },
data: { email: user.email, password: user.password }, //더 받아오기
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@param은 email, password이고,
@returns는 User객체에 email, token, username, bio, image가 담겨있습니다.
여기서 param데이터를 넣으면 되는지, return데이터를 넣으면 되는지 모르겠습니다.

Copy link
Member

Choose a reason for hiding this comment

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

음 잘 하고계시는데, param과 return이 헷갈린다는게 이해가 안되네요?
지금 넣고있는 data 안에 return데이터를 넣어야되는지 헷갈린다는 뜻인가요?

Comment on lines 123 to 132
const getArticleFeed = (limit, offset) =>
conduitAxios.get(`/articles/feed`, {
data: {
author: article.author,
createdAt: article.createdAt,
favoritesCount: article.favoritesCount,
title: article.title,
description: article.description,
},
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

위의 리뷰와 같이 param데이터를 넣으면 되는지, returns데이터를 넣으면 되는지 모르겠습니다.

@netlify
Copy link

netlify bot commented Sep 15, 2022

Deploy Preview for ssusdc-blog-team2 ready!

Name Link
🔨 Latest commit ad9c620
🔍 Latest deploy log https://app.netlify.com/sites/ssusdc-blog-team2/deploys/63231dec5aef5b000bb2d938
😎 Deploy Preview https://deploy-preview-44--ssusdc-blog-team2.netlify.app/dist
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

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.

2 participants