-
Notifications
You must be signed in to change notification settings - Fork 37
[이석찬] sprint9 #310
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
Merged
Lanace
merged 3 commits into
codeit-bootcamp-frontend:Next-이석찬
from
SeokChan-Lee:Next-이석찬-sprint9
Jan 28, 2025
The head ref may contain hidden characters: "Next-\uC774\uC11D\uCC2C-sprint9"
Merged
[이석찬] sprint9 #310
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { ArticleListResponse } from "@/types/articleTypes"; | ||
|
|
||
| export default async function fetchArticles( | ||
| page: number = 1, | ||
| pageSize: number = 10, | ||
| orderBy: "recent" | "like" = "recent", | ||
| keyword: string = "" | ||
| ): Promise<ArticleListResponse> { | ||
| const url = `https://panda-market-api.vercel.app/articles?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&keyword=${keyword}`; | ||
|
|
||
| try { | ||
| const response = await fetch(url); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`Failed to fetch articles: ${response.statusText}`); | ||
| } | ||
|
|
||
| const data: ArticleListResponse = await response.json(); | ||
| return data; | ||
| } catch (error) { | ||
| console.error("Error fetching articles:", error); | ||
| return { | ||
| totalCount: 0, | ||
| list: [], | ||
| }; | ||
| } | ||
|
Comment on lines
+20
to
+26
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 차라리 실패했을땐 error를 throw 하는게 좀더 좋을 수 있어요ㅎㅎ throw new Error(error); |
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| reactStrictMode: true, | ||
| } | ||
| images: { | ||
| domains: ["sprint-fe-project.s3.ap-northeast-2.amazonaws.com"], // 허용할 도메인 추가 | ||
| }, | ||
|
Comment on lines
+4
to
+6
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| }; | ||
|
|
||
| module.exports = nextConfig | ||
| module.exports = nextConfig; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이렇게되면 가독성이 좋진 않은것같아요ㅠ
그리고 서버에 따라서는 keyword가
처럼 공백문자인 경우에 이상한 값을 줄수있어서 optional이라면 아에 안보내는게 조금더 좋아요ㅎㅎ;;그래서 이런식으로 하면 어떨까요?
나중에 추가되는 값을 바로바로 볼 수 있고, 다루기도 쉬울것같아서요!