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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 2x 2x 6x 6x 6x 6x 6x 6x 1x 1x 1x 1x 6x 6x 6x 3x 3x 6x 6x 6x 6x 6x 6x 3x 3x 3x 3x 6x 6x 6x 7x 7x 6x 6x 6x 6x 6x 6x 6x | import { apiV1 } from '@/api/core';
import {
Availability,
FollowPathParams,
GetEmailAvailabilityQueryParams,
GetNicknameAvailabilityQueryParams,
GetUserPathParams,
UnfollowQueryParams,
UpdateMyImagePayloads,
UpdateMyInfoPayloads,
UpdateMyNotificationQueryParams,
User,
} from '@/types/service/user';
export const userServiceRemote = () => ({
// 1. 사용자 팔로우
followUser: async (pathParams: FollowPathParams) => {
return apiV1.post<string>(`/users/follow`, null, {
params: { followNickname: pathParams.followNickname },
});
},
// 2. 유저 프로필 변경
updateMyInfo: async (payloads: UpdateMyInfoPayloads) => {
return apiV1.patch<User>('/users/profile', payloads);
},
// 3. 프로필 이미지 변경
updateMyImage: async (payloads: UpdateMyImagePayloads) => {
const formData = new FormData();
formData.append('file', payloads.file);
return apiV1.patch<User>(`/users/profile-image`, formData);
},
// 4. 알림 설정 변경
updateMyNotification: async (queryParams: UpdateMyNotificationQueryParams) => {
return apiV1.patch<User>(`/users/notification`, null, {
params: { ...queryParams },
});
},
// 5. 유저 프로필 조회
getUser: async (pathParams: GetUserPathParams) => {
return apiV1.get<User>(`/users/${pathParams.userId}`);
},
// 6. 팔로우 리스트 조회
// getfollowUsers
// 7. 닉네임 중복 검사
getNicknameAvailability: async (queryParams: GetNicknameAvailabilityQueryParams) => {
return apiV1.get<Availability>(`/users/nickname/availability`, {
params: { nickname: queryParams.nickName },
});
},
// 8. 본인 프로필 조회
getMe: async () => {
return apiV1.get<User>(`/users/me`);
},
// 9. 이메일 중복 검사
getEmailAvailability: async (queryParams: GetEmailAvailabilityQueryParams) => {
return apiV1.get<Availability>(`/users/email/availability`, {
params: { email: queryParams.email },
});
},
// 10. 사용자 언팔로우
unfollowUser: async (params: UnfollowQueryParams) => {
return apiV1.delete<string>(`/users/unfollow`, {
params: { unFollowNickname: params.unFollowNickname },
});
},
});
|