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

69.44% Statements 25/36
100% Branches 3/3
60% Functions 3/5
69.44% Lines 25/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 371x 1x 1x 1x 1x 6x 6x               6x 6x 8x 8x 8x 8x 8x 6x 6x 8x 8x 8x 8x 8x 6x 6x 6x         6x  
import { api } from '@/api/core';
import { GetFollowParams, GetFollowResponse } from '@/types/service/follow';
import { FollowPathParams } from '@/types/service/user';
 
export const followerServiceRemote = () => ({
  // 팔로워 목록 조회
  getFollowers: async ({ userId, cursor, size = 20 }: GetFollowParams) => {
    return api.get<GetFollowResponse>(`/users/${userId}/follow`, {
      params: {
        cursor,
        size,
      },
    });
  },
 
  getFollowerList: async (params: GetFollowParams) => {
    const { userId, ...restParams } = params;
    return await api.get<GetFollowResponse>(`/users/${userId}/follower`, {
      params: { ...restParams },
    });
  },
 
  getFolloweeList: async (params: GetFollowParams) => {
    const { userId, ...restParams } = params;
    return await api.get<GetFollowResponse>(`/users/${userId}/follow`, {
      params: { ...restParams },
    });
  },
 
  // 팔로워 등록
  addFollower: async (params: FollowPathParams) => {
    return api.post<string>(`/users/follow`, null, {
      params: { followNickname: params.followNickname },
    });
  },
});