Skip to content

Commit 9f0fe4e

Browse files
committed
fix: follower api 수정
1 parent 1456e7d commit 9f0fe4e

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { Follower } from '@/types/service/follow';
33

44
export const followerServiceRemote = () => ({
55
// 팔로워 목록 조회
6-
// 임시주소로 작성. 나중에 수정 필요.
7-
getFollowers: async () => {
8-
return api.get<Follower[]>('/followers');
6+
getFollowers: async ({ userId }: { userId: number }) => {
7+
return api.get<Follower[]>(`/${userId}/followers`);
98
},
109
});

src/app/message/page.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useSearchParams } from 'next/navigation';
44

5-
import { Chat, FollowingList, FollowingSearch } from '@/components/pages/message';
5+
import { Chat, FollowingList, FollowingNone, FollowingSearch } from '@/components/pages/message';
66
import { TabNavigation } from '@/components/shared';
77
import { useGetFollowers } from '@/hooks/use-follower/use-follower-get';
88

@@ -16,7 +16,6 @@ export default function FollowingPage() {
1616

1717
const params = useSearchParams();
1818
const tab = params.get('tab') || 'following';
19-
if (!followers) return null;
2019
return (
2120
<div className='min-h-screen bg-[#F1F5F9]'>
2221
<TabNavigation basePath='/message' tabs={SOCIAL_TABS} />
@@ -25,7 +24,14 @@ export default function FollowingPage() {
2524
{tab === 'following' && (
2625
<>
2726
<FollowingSearch />
28-
<FollowingList items={followers} />
27+
28+
{followers && followers.length > 0 ? (
29+
<FollowingList items={followers} />
30+
) : (
31+
<div className='flex flex-1 items-center justify-center'>
32+
<FollowingNone />
33+
</div>
34+
)}
2935
</>
3036
)}
3137
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { Chat } from './chat';
22
export { FollowingCard } from './message-following-card';
33
export { FollowingList } from './message-following-list';
4+
export { FollowingNone } from './message-following-none';
45
export { FollowingSearch } from './message-following-search';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const FollowingNone = () => {
2+
return <div className='text-gray-600'>아직 팔로우 한 사람이 없어요.</div>;
3+
};

src/mock/service/followers/followers-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { http, HttpResponse } from 'msw';
33
import { createMockErrorResponse, createMockSuccessResponse } from '../common/common-mock';
44
import { mockFollowingItems } from './followers-mocks';
55

6-
const getFollowersMock = http.get('*/followers', () => {
6+
const getFollowersMock = http.get(`*/:userId/followers`, () => {
77
if (!mockFollowingItems) {
88
return HttpResponse.json(
99
createMockErrorResponse({

0 commit comments

Comments
 (0)