-
Notifications
You must be signed in to change notification settings - Fork 44
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
경북대 FE_이정민 6주차 과제 Step1,2 #76
Open
userjmmm
wants to merge
19
commits into
kakao-tech-campus-2nd-step2:userjmmm
Choose a base branch
from
userjmmm:step1-userjmmm
base: userjmmm
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4c8e346
chore: 로그인 및 관심목록 코드 준비
9730e7a
refactor: useGetCategories 파일명 오타 수정
59cc0c8
refactor: CategoryResponseData 타입을 Pageable에 맞추어 수정
e403736
refactor: 옵션 선택 시 총 결제 금액이 계산되도록 수정
0f58ca5
refactor: 옵션 핸들링 로직 수정
a8c2d1c
feat: 상단 네비게이션 바에서 백엔드 API 선택하는 기능 추가
bfef5aa
refactor: baseUrl이 변경될 때 실시간으로 반영하도록 수정
9b3af7e
feat: 모든 카테고리를 받아올 수 있도록 하는 로직 추가
6117daf
refactor: useGetProducts.ts에서 getProductsPath의 쿼리 매개변수 순서 변경
c4baf5e
feat: 서버에서 받아온 token을 저장해서 로그인 상태 유지되는 로직 추가
8f1bb84
feat: 위시 조회시 Page<WishList>로 return 받을 수 있도록 Data 타입 추가
cc36364
refactor: localStorage로 로그아웃 기능 가능하도록 수정
8999b15
feat: 변경된 API에 맞춰 위시 삭제 기능 추가
d611714
feat: 토큰 디코딩해서 사용자 이름 받아오는 기능 추가
08a112b
feat: 주문 페이지에서 상품 옵션까지 받아오는 기능 추가
b8a7096
chore(ui): 카카오로 로그인 하는 로그인 페이지 UI 수정
1b337dc
refactor: 옵션마다 post 요청 각각 진행하도록 수정
11940e7
refactor: 재용님 BASE_URL 변경
d168557
refactor(ui): 주문하기 페이지에서 선택한 옵션을 모두 확인할 수 있게 UI 변경
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 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 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,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>OAuth Callback</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
text-align: center; | ||
margin-top: 50px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>OAuth Callback</h1> | ||
<p id="tokenDisplay">토큰을 기다리고 있습니다...</p> | ||
<script> | ||
const params = new URLSearchParams(window.location.search); | ||
const token = params.get('tokenValue'); | ||
|
||
if (token) { | ||
// 토큰이 존재하면 로컬 스토리지에 저장 | ||
console.log('Received token:', token); | ||
localStorage.setItem('authToken', token); | ||
window.location.href = '/'; | ||
} else { | ||
console.error('Token not found in query parameters.'); | ||
tokenDisplay.textContent = 'Token not found in query parameters.'; | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -2,6 +2,8 @@ import { QueryClient } from '@tanstack/react-query'; | |
import type { AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
import axios from 'axios'; | ||
|
||
let BASE_URL = localStorage.getItem('baseURL') || 'https://api.example.com'; | ||
|
||
Comment on lines
+5
to
+6
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. let으로 선언하는 이유가 무엇일까요? |
||
const initInstance = (config: AxiosRequestConfig): AxiosInstance => { | ||
const instance = axios.create({ | ||
timeout: 5000, | ||
|
@@ -16,10 +18,8 @@ const initInstance = (config: AxiosRequestConfig): AxiosInstance => { | |
return instance; | ||
}; | ||
|
||
export const BASE_URL = 'https://api.example.com'; | ||
// TODO: 추후 서버 API 주소 변경 필요 | ||
export const fetchInstance = initInstance({ | ||
baseURL: 'https://api.example.com', | ||
export let fetchInstance = initInstance({ | ||
baseURL: BASE_URL, | ||
}); | ||
|
||
export const queryClient = new QueryClient({ | ||
|
@@ -32,3 +32,17 @@ export const queryClient = new QueryClient({ | |
}, | ||
}, | ||
}); | ||
|
||
export const updateBaseUrl = (newBaseUrl: string) => { | ||
BASE_URL = newBaseUrl; | ||
localStorage.setItem('baseURL', newBaseUrl); | ||
fetchInstance = initInstance({ | ||
baseURL: BASE_URL, | ||
}); | ||
// 선택한 이름마다 잘 받아오는지 확인용, 추후 삭제 예정 | ||
console.log('Updated fetchInstance:', fetchInstance.defaults.baseURL); | ||
}; | ||
|
||
export const getBaseUrl = () => { | ||
return localStorage.getItem('baseURL') || 'https://api.example.com'; | ||
}; |
This file contains 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 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
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.
currentPage, hasNextPage가 getCategories 함수의 책임일까요?