-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/98/crew api 연결 : 바뀐 백엔드 API 다시 적용 #119
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
Changes from all commits
ff9d3f5
bc4056a
6ac757f
0936ad1
e64877f
ab7d7a9
b4a70ff
22f3307
60a3b12
1026125
56bea37
1d430b1
3a7ce8e
ecd941d
9a3f685
89632d1
04225e6
ae1729a
b4b356c
67886c3
3213309
b9b5cb5
5687085
c3382b1
be1480d
3c567f3
abdc917
7642e5b
84780af
47f45c4
8f150e0
3febcae
1ce21b6
268e90f
9760c91
2b0587b
efd52d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,21 +5,16 @@ export async function getCrewList(condition: ConditionTypes, pageable: PageableT | |||||||||||
| const { keyword, mainLocation, mainCategory, subCategory, sortType } = condition; | ||||||||||||
| const { page, size, sort = ['string'] } = pageable; | ||||||||||||
|
|
||||||||||||
| try { | ||||||||||||
| const response = await fetchApi<MainCrewListResponse>( | ||||||||||||
| `/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`, | ||||||||||||
| { | ||||||||||||
| method: 'GET', | ||||||||||||
| headers: { | ||||||||||||
| 'Content-Type': 'application/json', | ||||||||||||
| }, | ||||||||||||
| credentials: 'include', // 인증 정보를 요청에 포함 | ||||||||||||
| const response: { data: MainCrewListResponse } = await fetchApi( | ||||||||||||
| `/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`, | ||||||||||||
| { | ||||||||||||
| method: 'GET', | ||||||||||||
| headers: { | ||||||||||||
| 'Content-Type': 'application/json', | ||||||||||||
| }, | ||||||||||||
| ); | ||||||||||||
| return response; | ||||||||||||
| } catch (error) { | ||||||||||||
| // eslint-disable-next-line no-console | ||||||||||||
| console.error(error); | ||||||||||||
| return undefined; | ||||||||||||
| } | ||||||||||||
| credentials: 'include', // 인증 정보를 요청에 포함 | ||||||||||||
| }, | ||||||||||||
| ); | ||||||||||||
|
|
||||||||||||
| return response?.data; | ||||||||||||
|
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. 🛠️ Refactor suggestion 응답 데이터 유효성 검증이 필요합니다.
다음과 같이 데이터 검증을 추가하는 것을 제안드립니다: - return response?.data;
+ if (!response?.data) {
+ throw new Error('서버로부터 유효하지 않은 응답을 받았습니다.');
+ }
+ return response.data;📝 Committable suggestion
Suggested change
Comment on lines
+8
to
+19
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. 💡 Codebase verification API 응답 구조가 변경되지 않았습니다.
🔗 Analysis chainAPI 응답 구조 변경 사항 확인이 필요합니다. AI 요약에 따르면 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check the interface definition and its usage
ast-grep --pattern 'interface $interface {
$$$
content: $type
$$$
}'
# Check for any remaining uses of the old property name
rg -l "\.data\b" --type ts
Length of output: 635 |
||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,6 @@ export interface MyCrewList { | |
| } | ||
|
|
||
| export interface MyCrewListResponse { | ||
| data: MyCrewList[]; | ||
| content: MyCrewList[]; | ||
| hasNext: boolean; | ||
| } | ||
|
Comment on lines
+68
to
70
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. 💡 Codebase verification 일부 관련 컴포넌트들이 아직 'data' 속성을 사용하고 있습니다.
🔗 Analysis chain관련 컴포넌트들의 업데이트 여부를 확인해주세요. 이 인터페이스를 사용하는 모든 컴포넌트들이 새로운 속성 이름( 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: 이 인터페이스를 사용하는 컴포넌트들을 검색하여 업데이트가 필요한 부분을 확인합니다.
# MyCrewListResponse 타입을 사용하는 파일들을 검색
echo "MyCrewListResponse를 사용하는 파일 검색:"
rg "MyCrewListResponse" --type ts --type tsx
# 이전 속성명 'data'를 여전히 사용하고 있는 코드를 검색
echo "\n이전 속성명 'data'를 사용하는 코드 검색:"
rg "data\?\.pages" --type ts --type tsx
Length of output: 288 Script: #!/bin/bash
# Description: 이 인터페이스를 사용하는 컴포넌트들을 다시 검색하여 업데이트가 필요한 부분을 확인합니다.
# MyCrewListResponse 타입을 사용하는 파일들을 검색 (.ts, .tsx 파일)
echo "MyCrewListResponse를 사용하는 파일 검색 (ts, tsx):"
rg "MyCrewListResponse" -g "*.ts" -g "*.tsx"
# 이전 속성명 'data'를 여전히 사용하는 코드를 검색 (.ts, .tsx 파일)
echo "\n이전 속성명 'data'를 사용하는 코드 검색 (ts, tsx):"
rg "data\?\.pages" -g "*.ts" -g "*.tsx"
Length of output: 1202 |
||
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 호출에서 오류 처리가 누락되었습니다.
API 호출 시 발생할 수 있는 네트워크 오류나 서버 오류에 대한 처리가 없습니다. 사용자 경험 향상을 위해 적절한 오류 처리가 필요합니다.
다음과 같이 오류 처리를 추가하는 것을 제안드립니다:
async function getCrewList(condition: ConditionTypes, pageable: PageableTypes) { const { keyword, mainLocation, mainCategory, subCategory, sortType } = condition; const { page, size, sort = ['string'] } = pageable; + try { const response: { data: MainCrewListResponse } = await fetchApi( `/api/crews/search?keyword=${keyword}&mainLocation=${mainLocation}&mainCategory=${mainCategory}&subCategory=${subCategory}&sortType=${sortType}&page=${page}&size=${size}&sort=${sort}`, { method: 'GET', headers: { 'Content-Type': 'application/json', }, credentials: 'include', }, ); return response?.data; + } catch (error) { + console.error('크루 목록을 불러오는 중 오류가 발생했습니다:', error); + throw new Error('크루 목록을 불러오는데 실패했습니다.'); + } }📝 Committable suggestion