diff --git a/src/_apis/crew/crew-list.ts b/src/_apis/crew/crew-list.ts index 75a561ac..f2719143 100644 --- a/src/_apis/crew/crew-list.ts +++ b/src/_apis/crew/crew-list.ts @@ -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( - `/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; } diff --git a/src/components/common/crew-list/crew-card-list.tsx b/src/components/common/crew-list/crew-card-list.tsx index fca949b8..e5ca247d 100644 --- a/src/components/common/crew-list/crew-card-list.tsx +++ b/src/components/common/crew-list/crew-card-list.tsx @@ -31,8 +31,8 @@ function CrewCardList( ) { const crewDataList = (inWhere === 'my-crew' - ? data?.pages.flatMap((page) => page?.data as MyCrewList[]) - : data?.pages?.flatMap((page) => page?.content as MainCrewList[])) ?? []; + ? data?.pages.flatMap((page) => page?.content) + : data?.pages?.flatMap((page) => page?.content)) ?? []; const gridColsStyle = inWhere === 'my-crew' ? '' : 'lg:grid-cols-2'; if (data?.pages[0] === undefined) @@ -63,7 +63,11 @@ function CrewCardList( title={inform?.title} mainLocation={inform?.mainLocation} subLocation={inform?.subLocation} - imageUrl={inform?.imageUrl} + imageUrl={ + inform?.imageUrl === 'string' + ? 'https://media.istockphoto.com/id/1396814518/vector/image-coming-soon-no-photo-no-thumbnail-image-available-vector-illustration.jpg?s=612x612&w=0&k=20&c=hnh2OZgQGhf0b46-J2z7aHbIWwq8HNlSDaNp2wn_iko=' + : inform?.imageUrl + } totalCount={inform?.totalCount} participantCount={ inWhere === 'my-crew' diff --git a/src/types/crew-card.d.ts b/src/types/crew-card.d.ts index 3c971e5e..964c0a9b 100644 --- a/src/types/crew-card.d.ts +++ b/src/types/crew-card.d.ts @@ -65,6 +65,6 @@ export interface MyCrewList { } export interface MyCrewListResponse { - data: MyCrewList[]; + content: MyCrewList[]; hasNext: boolean; }