-
Notifications
You must be signed in to change notification settings - Fork 31
[김수연] Sprint8 #118
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
dongqui
merged 4 commits into
codeit-bootcamp-frontend:React-김수연
from
ramong26:React-김수연
Apr 9, 2025
The head ref may contain hidden characters: "React-\uAE40\uC218\uC5F0"
Merged
[김수연] Sprint8 #118
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,19 @@ | ||
| import { Outlet, useLocation } from 'react-router-dom' | ||
| import ItemsNavVar from '../component/common/ItemsNavVar' | ||
|
|
||
| const NavVArLayout = () => { | ||
| const { pathname } = useLocation() // 현재 페이지가 어떤 페이지인지 감지 | ||
|
|
||
| const isItemsPage = pathname === '/additem' || pathname.startsWith('/items') | ||
| const isBoardsPage = pathname === '/boards' | ||
|
|
||
| return ( | ||
| <> | ||
| <ItemsNavVar isItemsPage={isItemsPage} isBoardsPage={isBoardsPage} /> | ||
| <Outlet /> | ||
| {/*Outlet을 통해 하위 라우트 렌더링함. App 컴포넌트에서 확인 가능 */} | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| export default NavVArLayout |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
| import { AxiosRequestConfig } from 'axios' | ||
|
|
||
| export const requestInterceptor = ( | ||
| config: AxiosRequestConfig | ||
| ): AxiosRequestConfig => { | ||
| const token: string | null = localStorage.getItem('token') | ||
|
|
||
| if (token) { | ||
| config.headers = config.headers || {} | ||
| config.headers['Authorization'] = `Basic ${token}` | ||
| } | ||
| return config | ||
| } | ||
|
|
||
| // 전 코드 | ||
| // import { AxiosRequestConfig } from 'axios' | ||
|
|
||
| // export const requestInterceptor = (config: AxiosRequestConfig) => { | ||
| // const { token } = localStorage.getItem('token') ?? '' | ||
|
|
||
| // if (token) { | ||
| // config.headers.set('Authorization', `Basic${token}`) | ||
| // } | ||
| // return config | ||
| // } |
File renamed without changes.
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
8 changes: 5 additions & 3 deletions
8
src/api/services/productService.jsx → src/api/services/productService.tsx
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
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,25 @@ | ||
| declare module '*.png' { | ||
| const value: string | ||
| export default value | ||
| } | ||
|
|
||
| declare module '*.jpg' { | ||
| const value: string | ||
| export default value | ||
| } | ||
|
|
||
| declare module '*.jpeg' { | ||
| const value: string | ||
| export default value | ||
| } | ||
|
|
||
| declare module '*.gif' { | ||
| const value: string | ||
| export default value | ||
| } | ||
|
|
||
| declare module '*.svg' { | ||
| const value: string | ||
| export default value | ||
| } | ||
| // 문자열로 타입선언하는 이유는 <img src="경로"> 이기 때문 |
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.
이렇게 하셔도 됩니다만, 라이브러리를 쓰실 때 해당 라이브러리에서 제공해주는 타입이 어떤지 살펴보고 활용해 보시는 것도 좋습니다.
예를 들면 axios의 경우 get 메서드에 제네릭을 제공합니다!

따라서 requestor.get 제네릭에 Comment를 넘겨주면 getProductComment의 리턴 타입은 자동으로 잡히게 되는거죠~!
라이브러리의 타입은 알트(맥은 커맨드) + 클릭으로 확인하실 수 있습니다!
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.
저 스크린샷이 공포스럽게 느껴질 수도 있을 거 같아 추가로 말씀드리면, 처음엔 눈에 안 들어오는 것이 너무 당연합니다!
꼭 저렇게 찾아 들어가지 않고 다른 사람이 사용한 코드를 참고하셔도 좋습니다! 조금씩 쓰고, 보다 보면 익숙해 지실거에요 :)