-
Notifications
You must be signed in to change notification settings - Fork 6
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] Refactor/#643: Profile 페이지 API 로직 수정 및 React-Query 적용 #647
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bbcfd93
feat: http 모듈 추가
GC-Park 223e0ea
feat: Profile get api 추가
GC-Park 1310d86
feat: useProfileList hook 추가
GC-Park bf162c3
refactor: fetchGet을 useProfileList로 변경
GC-Park 0bec8fc
refactor: getProfile api에 url 직접 입력으로 변경
GC-Park 26e5bd5
refactor: 사용하지 않는 매개 변수 삭제 및 queryFn 수정
GC-Park ce1fd8a
refactor: 필요없는 코드 삭제
GC-Park ed69207
refactor: query refetch 추가
GC-Park 0422d45
refactor: tanstack query 기본 설정 추가
GC-Park be61c4f
refactor: profile리스트 가져오는 부분 query 추가 및 필요없는 코드 삭제
GC-Park 174a674
refactor: useQuery를 useSuspenseQuery로 변경
GC-Park a108bac
refactor: Profile에 Query suspense 적용
GC-Park 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
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,36 @@ | ||
import axios, { AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
|
||
const API_PREFIX = 'api'; | ||
|
||
export const BASE_URL = | ||
process.env.APP_URL || `https://mapbefine.com/${API_PREFIX}`; | ||
|
||
const axiosInstance = axios.create({ | ||
baseURL: BASE_URL, | ||
timeout: 5000, | ||
}); | ||
|
||
export interface HttpClient extends AxiosInstance { | ||
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>; | ||
post<T = unknown>( | ||
url: string, | ||
data?: any, | ||
config?: AxiosRequestConfig, | ||
): Promise<T>; | ||
patch<T = unknown>( | ||
url: string, | ||
data?: any, | ||
config?: AxiosRequestConfig, | ||
): Promise<T>; | ||
put<T = unknown>( | ||
url: string, | ||
data?: any, | ||
config?: AxiosRequestConfig, | ||
): Promise<T>; | ||
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>; | ||
} | ||
|
||
export const http: HttpClient = axiosInstance; | ||
|
||
// axios.interceptors.request.use() | ||
axios.interceptors.response.use((res) => res.data) |
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,6 @@ | ||
import { http } from './http'; | ||
import { TopicCardProps } from '../../types/Topic'; | ||
|
||
export const getProfile = () => { | ||
return http.get<TopicCardProps[] | null>("/members/my/topics"); | ||
}; |
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,13 @@ | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { getProfile } from '../../apis/Patrick'; | ||
|
||
const useProfileList = () => { | ||
const { data, refetch } = useSuspenseQuery({ | ||
queryKey: ['profileList'], | ||
queryFn: getProfile, | ||
}); | ||
|
||
return { data, refetch }; | ||
}; | ||
|
||
export default useProfileList; |
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.
리프레쉬 토큰 패트릭이 보여주시나요? ㅎㅎ
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.
하핳..! 전 아이크만 바라보고 있습니다 그저 빛.. 🔦