Skip to content

Commit

Permalink
스프린트 미션 6 진행 중
Browse files Browse the repository at this point in the history
  • Loading branch information
stella-418 committed Oct 19, 2024
1 parent e1dcf29 commit ee24f69
Show file tree
Hide file tree
Showing 25 changed files with 491 additions and 287 deletions.
129 changes: 115 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.26.1",
"react-scripts": "5.0.1",
"styled-components": "^6.1.13",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
43 changes: 25 additions & 18 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,32 @@
* @returns
*/
export async function getItems(
page = 1,
pageSize = 10,
orderBy = "recent",
keyword
page = 1,
pageSize = 10,
orderBy = "recent",
keyword
) {
const searchQuery = keyword ? `keyword=${keyword}` : "";
const response = await fetch(
`https://panda-market-api.vercel.app/products?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&${searchQuery}`
);
const body = await response.json();
return body;
const searchQuery = keyword ? `keyword=${keyword}` : "";
const response = await fetch(
`https://panda-market-api.vercel.app/products?page=${page}&pageSize=${pageSize}&orderBy=${orderBy}&${searchQuery}`
);
const body = await response.json();
return body;
}

// // 1페이지 10개 최신순 줘
// const 1페이지10개 = getItems(1,10,"recent")
// const 2페이지10개 = getItems(2,10,"recent")
// const 3페이지10개 = getItems(3,10,"recent")

// // 최신순으로 1페이지 1개 줘
// const 1페이지10개 = getItems(1,10,"favorite")
// const 2페이지10개 = getItems(2,10,"favorite")
// const 3페이지10개 = getItems(3,10,"favorite")

export async function addItem(requestBody) {
const response = await fetch("https://panda-market-api.vercel.app/products", {
method: "POST",
body: JSON.stringify({
images: requestBody.images,
tags: requestBody.tags,
price: requestBody.price,
description: requestBody.description,
name: requestBody.name,
}),
});
return response;
}

13 changes: 7 additions & 6 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Nav from "./Nav";


function App({ children }) {
return (
<div>
<Nav></Nav>
<div>{children}</div>
</div>
);
return (
<div>
<Nav></Nav>
<div>{children}</div>
</div>
);
}

export default App;
32 changes: 0 additions & 32 deletions src/components/BestList.js

This file was deleted.

Loading

0 comments on commit ee24f69

Please sign in to comment.