-
Notifications
You must be signed in to change notification settings - Fork 26
[양재영] sprint7 #126
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-\uC591\uC7AC\uC601-sprint7"
[양재영] sprint7 #126
Changes from all commits
f6f6c43
c4ddadc
8f44776
f5fd8eb
6dcd364
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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export default { | ||
| plugins: { | ||
| tailwindcss: {}, | ||
| autoprefixer: {}, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,23 +9,26 @@ const instance = axios.create({ | |
| }, | ||
| }); | ||
|
|
||
| export const ERROR_STATUSCODE_MESSAGES = { | ||
| 401: "인증이 필요합니다. 로그인 해주세요.", | ||
| 403: "접근 권한이 없습니다.", | ||
| 404: "요청하신 리소스를 찾을 수 없습니다.", | ||
| 500: "서버 오류가 발생했습니다. 잠시 후 다시 시도해주세요.", | ||
| }; | ||
|
Comment on lines
+12
to
+17
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. 크으 ~ 상태 코드에 맞는 안내메시지도 정의해두셨군요 ! 😉이렇게 해두면 활용성이 좋겠어요 ! |
||
|
|
||
| instance.interceptors.response.use( | ||
| (response) => { | ||
| return response; | ||
| }, | ||
| (error) => { | ||
| if (error.response) { | ||
| const status = error.response.status; | ||
|
|
||
| if (status === 401) { | ||
| alert("인증이 필요합니다. 로그인 해주세요."); | ||
| } else if (status === 500) { | ||
| alert("서버 오류가 발생했습니다. 잠시 후 다시 시도해주세요."); | ||
| } | ||
| alert( | ||
| ERROR_STATUSCODE_MESSAGES[status] || "알 수 없는 오류가 발생했습니다." | ||
| ); | ||
|
Comment on lines
+26
to
+28
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. 공통 API 함수에
|
||
| } else { | ||
| alert("네트워크 오류가 발생했습니다."); | ||
| } | ||
|
|
||
| return Promise.reject(error); | ||
| } | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,15 @@ | ||
| import { useEffect, useRef, useState } from "react"; | ||
| import selectIcon from "../assets/ic-sort.svg"; | ||
|
|
||
| const options = [ | ||
| { label: "최신순", value: "recent" }, | ||
| { label: "좋아요순", value: "favorite" }, | ||
| ]; | ||
|
Comment on lines
+4
to
+7
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. 크으 ~ 컴포넌트 바깥에 선언해두셨군요 !좋습니다. 이제 컴포넌트 내부에는 컴포넌트 자원을 사용하는 로직들로만 구성되어 있게되었어요 👍👍 |
||
|
|
||
| export default function SelectDropdown({ onChange, value }) { | ||
| const [isOpen, setIsOpen] = useState(false); | ||
| const dropdownRef = useRef(null); | ||
|
|
||
| const options = [ | ||
| { label: "최신순", value: "recent" }, | ||
| { label: "좋아요순", value: "favorite" }, | ||
| ]; | ||
|
|
||
| const selected = options.find((opt) => opt.value === value); | ||
|
|
||
| const handleSelect = (option) => { | ||
|
|
@@ -32,6 +32,7 @@ export default function SelectDropdown({ onChange, value }) { | |
| <div ref={dropdownRef} className="select-dropdown"> | ||
| <div className="selected-option" onClick={() => setIsOpen(!isOpen)}> | ||
| <img src={selectIcon} alt="드롭다운 아이콘" /> | ||
| <span>{selected ? selected.label : "선택"}</span> | ||
| </div> | ||
|
|
||
| {isOpen && ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| @tailwind base; | ||
| @tailwind components; | ||
| @tailwind utilities; | ||
|
|
||
| @layer base { | ||
| body { | ||
| /* Apply Pretendard font */ | ||
| @apply font-pretendard; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import App from "./App"; | ||
| import ReactDOM from "react-dom/client"; | ||
| import "./index.css"; | ||
|
|
||
| const root = ReactDOM.createRoot(document.getElementById("root")); | ||
| root.render(<App />); |
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 함수가 정말 깔끔하네요 👍👍
에러 처리,
axios의 파라메터도 적절하게 잘 채워넣으셨구요 ! 굿굿 !