Skip to content

Commit 53f96d3

Browse files
authored
Merge pull request #279 from WeGo-Together/minseo-feat/schedule-filter
[Feat] 나의 모임 및 모임 이력 탭에 filter=ALL 파라미터 추가
2 parents bed6cce + c5c8b5c commit 53f96d3

File tree

6 files changed

+35
-10
lines changed

6 files changed

+35
-10
lines changed

src/api/service/group-service/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ export const groupServiceRemote = () => ({
3333
params.append('cursor', payload.cursor.toString());
3434
}
3535
params.append('size', payload.size.toString());
36+
if (payload.filter) {
37+
params.append('filter', payload.filter);
38+
}
39+
if (payload.includeStatuses && payload.includeStatuses.length > 0) {
40+
payload.includeStatuses.forEach((status) => {
41+
params.append('includeStatuses', status);
42+
});
43+
}
44+
if (payload.excludeStatuses && payload.excludeStatuses.length > 0) {
45+
payload.excludeStatuses.forEach((status) => {
46+
params.append('excludeStatuses', status);
47+
});
48+
}
49+
if (payload.myStatuses && payload.myStatuses.length > 0) {
50+
payload.myStatuses.forEach((status) => {
51+
params.append('myStatuses', status);
52+
});
53+
}
3654

3755
return apiV2.get<GetMyGroupsResponse>(`/groups/me?${params.toString()}`);
3856
},
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export default function History() {
1212
const { items, error, fetchNextPage, hasNextPage, isFetchingNextPage, completedMessage } =
1313
useInfiniteScroll<GroupListItemResponse, ['myGroups', 'past']>({
1414
queryFn: async ({ cursor, size }) => {
15-
return await API.groupService.getMyGroups({ type: 'past', cursor, size });
15+
return await API.groupService.getMyGroups({
16+
type: 'past',
17+
cursor,
18+
size,
19+
filter: 'ALL',
20+
});
1621
},
1722
queryKey: ['myGroups', 'past'],
1823
pageSize: 10,

src/app/schedule/(components)/meeting-list.tsx renamed to src/app/schedule/_components/meeting-list.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,5 @@ export const MeetingList = ({
143143
</section>
144144
);
145145
};
146+
147+
//
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ export default function My() {
1212
const { items, error, fetchNextPage, hasNextPage, isFetchingNextPage, completedMessage } =
1313
useInfiniteScroll<GroupListItemResponse, ['myGroups', 'myPost']>({
1414
queryFn: async ({ cursor, size }) => {
15-
return await API.groupService.getMyGroups({ type: 'myPost', cursor, size });
15+
return await API.groupService.getMyGroups({
16+
type: 'myPost',
17+
cursor,
18+
size,
19+
filter: 'ALL',
20+
});
1621
},
1722
queryKey: ['myGroups', 'myPost'],
1823
pageSize: 10,

src/app/schedule/page.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { Suspense } from 'react';
66

77
import { TabNavigation } from '@/components/shared';
88

9-
import Current from './(components)/current';
10-
import History from './(components)/history';
11-
import My from './(components)/my';
9+
import Current from './_components/current';
10+
import History from './_components/history';
11+
import My from './_components/my';
1212

1313
const SCHEDULE_TABS = [
1414
{ label: '현재 모임', value: 'current' },
@@ -40,8 +40,3 @@ export default function SchedulePage() {
4040
</div>
4141
);
4242
}
43-
44-
// 나중에 api 연동할 때
45-
// 1. ScheduleContent를 감싸던 임시 Suspense 제거해야됨
46-
// 2. useSearchParams()는 그대로 유지
47-
// 3. Current, My, History를 서버 컴포넌트로 변경 (use client 제거) - 서버에서 데이터 페칭

0 commit comments

Comments
 (0)