diff --git a/public/icons/x-white.svg b/public/icons/x-white.svg index d30d6855..a69e81c2 100644 --- a/public/icons/x-white.svg +++ b/public/icons/x-white.svg @@ -1,4 +1,4 @@ - - - + + + diff --git a/public/icons/x.svg b/public/icons/x.svg index 242c10bf..ea63ac64 100644 --- a/public/icons/x.svg +++ b/public/icons/x.svg @@ -1,4 +1,4 @@ - - - + + + diff --git a/src/apis/getCloseGatheringData.ts b/src/apis/getCloseGatheringData.ts new file mode 100644 index 00000000..eadca6e2 --- /dev/null +++ b/src/apis/getCloseGatheringData.ts @@ -0,0 +1,13 @@ +import { instance } from '@/apis/api'; +import type { GetCloseGatheringResponse } from '@manchui-api'; + +export async function getCloseGatheringData(): Promise { + try { + const res = await instance.get('/api/gatherings'); + + return res.data; + } catch (e) { + console.log('GetCloseGatheringResponse 함수에서 오류 발생', e); + throw new Error('닫힌 모임 데이터를 불러오는데 실패했습니다.'); + } +} diff --git a/src/apis/getCloseGatheringIdData.ts b/src/apis/getCloseGatheringIdData.ts new file mode 100644 index 00000000..264aab26 --- /dev/null +++ b/src/apis/getCloseGatheringIdData.ts @@ -0,0 +1,13 @@ +import { instance } from '@/apis/api'; +import type { GetCloseGatheringIdResponse } from '@manchui-api'; + +export async function getCloseGatheringIdData(gatheringsId: number): Promise { + try { + const res = await instance.get(`/api/gatherings/${gatheringsId}`); + + return res.data; + } catch (e) { + console.log('getCloseGatheringIdData 함수에서 오류 발생', e); + throw new Error('닫힌 모임 데이터를 불러오는데 실패했습니다.'); + } +} diff --git a/src/apis/getReviewData.ts b/src/apis/getReviewData.ts index 8e184cb9..624cc2f2 100644 --- a/src/apis/getReviewData.ts +++ b/src/apis/getReviewData.ts @@ -1,16 +1,17 @@ import { instanceWithoutAccess } from '@/apis/api'; import type { GetReviewResponse } from '@manchui-api'; -type GetReviewProps= { +type GetReviewProps = { category?: string; endDate?: string; location?: string; page?: number; query?: string; + score?: number; size?: number; sort?: string; startDate?: string; -} +}; export async function getReviewData({ page = 0, @@ -21,11 +22,13 @@ export async function getReviewData({ endDate, query, sort, + score, }: GetReviewProps): Promise { const params = new URLSearchParams({ page: page.toString(), size: size.toString(), ...(sort && { sort }), + ...(score && { score: score?.toString() }), ...(query && { query }), ...(category && { category }), ...(location && { location }), @@ -33,7 +36,6 @@ export async function getReviewData({ ...(endDate && { endDate }), }); - try { const res = await instanceWithoutAccess.get('/api/reviews?', { params, diff --git a/src/apis/getReviewScoreZeroData.ts b/src/apis/getReviewScoreZeroData.ts new file mode 100644 index 00000000..e9b8aa28 --- /dev/null +++ b/src/apis/getReviewScoreZeroData.ts @@ -0,0 +1,49 @@ +import { instanceWithoutAccess } from '@/apis/api'; +import type { GetReviewResponse } from '@manchui-api'; + +type GetReviewProps = { + category?: string; + endDate?: string; + location?: string; + page?: number; + query?: string; + score?: number; + size?: number; + sort?: string; + startDate?: string; +}; + +export async function getReviewScoreZeroData({ + page = 0, + size = 10, + category, + location, + startDate, + endDate, + query, + sort, + score = 0, +}: GetReviewProps): Promise { + const params = new URLSearchParams({ + page: page.toString(), + size: size.toString(), + ...(score && { score: score?.toString() }), + ...(sort && { sort }), + ...(query && { query }), + ...(category && { category }), + ...(location && { location }), + ...(startDate && { startDate }), + ...(endDate && { endDate }), + }); + + try { + const res = await instanceWithoutAccess.get('/api/reviews?', { + params, + }); + + return res.data; + } catch (e) { + console.error('getReviewScoreZeroData 함수에서 오류 발생:', e); + throw new Error('리뷰 데이터를 불러오는데 실패했습니다.'); + } +} diff --git a/src/components/Create/CapacityDropdown/index.tsx b/src/components/Create/CapacityDropdown/index.tsx index 477095f1..3faaeda3 100644 --- a/src/components/Create/CapacityDropdown/index.tsx +++ b/src/components/Create/CapacityDropdown/index.tsx @@ -20,8 +20,8 @@ export function CapacityDropdown({ errorMin, errorMax, selectedMinNum, selectedM return (

모집 정원

-
-
+
+

최소 인원

-
+

최대 인원

void; }; -export function CategoryDropdown({ setSelectedCategory ,error}: CategoryDropdownProps) { - const categoryList = FILTER_OPTIONS.slice(1).map(option => option.label); +export function CategoryDropdown({ closeGatheringIdData, setSelectedCategory, error }: CategoryDropdownProps) { + const categoryList = FILTER_OPTIONS.slice(1).map((option) => option.label); + const [placeholder, setPlaceholder] = useState('서비스 카테고리를 정해주세요.'); + useEffect(() => { + if (closeGatheringIdData) { + setSelectedCategory(closeGatheringIdData.category); + setPlaceholder(closeGatheringIdData.category); + } + }, [closeGatheringIdData, setSelectedCategory]); + const isCategorySelected = Boolean(closeGatheringIdData?.category); + + // console.log('Selected placeholder:', placeholder); return (

카테고리

- - {error &&

{error}를 선택하세요.

} + + {error &&

{error}를 선택하세요.

}
); } - diff --git a/src/components/Create/DescriptionInput/index.tsx b/src/components/Create/DescriptionInput/index.tsx index 23a343c9..6f7ebd96 100644 --- a/src/components/Create/DescriptionInput/index.tsx +++ b/src/components/Create/DescriptionInput/index.tsx @@ -17,7 +17,7 @@ export function DescriptionInput({ description, setDescription, error }: Descrip