-
Notifications
You must be signed in to change notification settings - Fork 39
[전지윤] Sprint 5 #199
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
The head ref may contain hidden characters: "React-\uC804\uC9C0\uC724-sprint5"
[전지윤] Sprint 5 #199
Changes from all commits
e6680d4
36d1637
126c4e7
2591dfd
6c9bee2
219b7f6
6b6cdab
e10733d
1efb68e
71d0645
d0ff1f5
68f1d35
9a8d2dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import axios from "axios"; | ||
|
|
||
| export const api = axios.create({ | ||
| baseURL: "https://panda-market-api.vercel.app", | ||
| headers: { "Content-Type": "application/json" }, | ||
| timeout: 5000, | ||
| }); | ||
|
|
||
| api.interceptors.response.use( | ||
| (res) => res, | ||
| (error) => { | ||
| const status = error.response?.status; | ||
| if (status === 404) { | ||
| alert("요청한 자원을 찾을 수 없습니다."); | ||
| } else if (status === 500) { | ||
| alert("서버에 문제가 발생했습니다."); | ||
| } else { | ||
| alert("문제가 발생했습니다."); | ||
| } | ||
| return Promise.reject(error); | ||
| } | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { api } from "./api"; | ||
| export default async function getItems(page, pageSize, sort = "") { | ||
| const res = await api.get( | ||
| `/products?page=${page}&pageSize=${pageSize}&orderBy=${sort}` | ||
| ); | ||
| return res.data; | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||
| import { Route, Routes } from "react-router"; | ||||||
| import AddItem from "./components/AddItem/AddItem"; | ||||||
| import Nav from "./common/Nav/Nav"; | ||||||
| import Items from "./components/Items/Items"; | ||||||
| import Products from "./components/Products/Products"; | ||||||
|
|
||||||
| export default function App() { | ||||||
| return ( | ||||||
| <> | ||||||
| <Nav /> | ||||||
| <Routes> | ||||||
| <Route path="/" element={<AddItem />} /> | ||||||
|
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. 💬 여담
Suggested change
|
||||||
| <Route path="/items" element={<Items />} /> | ||||||
| <Route path="/products" element={<Products />} /> | ||||||
| <Route path="/additem" element={<AddItem />} /> | ||||||
| </Routes> | ||||||
| </> | ||||||
| ); | ||||||
| } | ||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import pandaMarket from "../../image/pandaMarket.svg"; | ||
| import pandaFace from "../../image/pandaFace.svg"; | ||
| import blankProfile from "../../image/blankProfile.svg"; | ||
| import styles from "./Nav.module.scss"; | ||
| import { useLocation, useNavigate } from "react-router"; | ||
|
|
||
| export default function Nav() { | ||
| const navigate = useNavigate(); | ||
| const locate = useLocation(); | ||
| const location = locate.pathname; | ||
| return ( | ||
| <nav> | ||
| <div className={styles["nav--left"]}> | ||
| <div className={styles.logo} onClick={() => navigate("/")}> | ||
|
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. 💊 제안 |
||
| <img | ||
| src={pandaFace} | ||
| className={styles.pandaface} | ||
| alt="panda face" | ||
| ></img> | ||
| <img | ||
| src={pandaMarket} | ||
| className={styles.pandamarket} | ||
| alt="panda market" | ||
| ></img> | ||
| </div> | ||
| <div className={styles.menu}> | ||
| <span>자유게시판</span> | ||
| <span | ||
| onClick={() => navigate("/items")} | ||
| style={ | ||
| location === "/items" || "/additems" ? { color: "#3692FF" } : {} | ||
| } | ||
| > | ||
| 중고마켓 | ||
| </span> | ||
|
Comment on lines
+28
to
+35
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. ❗️ 수정요청 |
||
| </div> | ||
| </div> | ||
|
|
||
| <img | ||
| className={styles.profile} | ||
| src={blankProfile} | ||
| alt="blank profile" | ||
| ></img> | ||
| </nav> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| nav { | ||
| display: flex; | ||
| padding: 10px 200px; | ||
| justify-content: space-between; | ||
| border-bottom: 1px solid #dfdfdf; | ||
| } | ||
| .nav--left { | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 47px; | ||
| } | ||
|
|
||
| .logo { | ||
| display: flex; | ||
| gap: 8.6px; | ||
| } | ||
| .menu { | ||
| display: flex; | ||
| gap: 30px; | ||
| font-size: 18px; | ||
| font-weight: 700; | ||
| line-height: 26px; | ||
| color: #4b5563; //Secondary/600 | ||
| } | ||
|
|
||
| .logo, | ||
| .menu, | ||
| .profile { | ||
| cursor: pointer; | ||
| } | ||
| @media (max-width: 744px) { | ||
| nav { | ||
| padding: 10px 24px; | ||
| } | ||
| .nav--left { | ||
| gap: 20px; | ||
| } | ||
| } | ||
| @media (max-width: 376px) { | ||
| nav { | ||
| padding: 15px 16px; | ||
| } | ||
| .nav--left { | ||
| gap: 8px; | ||
| } | ||
| .pandaface { | ||
| display: none; | ||
| } | ||
| .pandamarket { | ||
| width: 81px; | ||
| } | ||
| .menu { | ||
| gap: 8px; | ||
| font-size: 16px; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export default function AddItem() { | ||
| return <div>addItem</div>; | ||
| } |
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를 호출하는 내부에서 처리할 수 있게 alert로 에러메시지를 보여주시는 것보다 에러에 해당 상황을 반환하시는 것이 좋을 것 같아요.