Skip to content

Commit

Permalink
refactor: (#63) 코드 가독성을 위해 타입 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilpop8663 committed Jul 20, 2023
1 parent e78e6ae commit 795c59d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions frontend/src/api/wus/userInfo.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ServerUser, User } from '@type/user';
import type { UserInfoResponse, User } from '@type/user';

import { getFetch } from '@utils/fetch';

export const transformUserInfoResponse = (userInfo: ServerUser): User => {
export const transformUserInfoResponse = (userInfo: UserInfoResponse): User => {
const { nickname, postCount, userPoint, voteCount, badge } = userInfo;

return {
Expand All @@ -15,7 +15,7 @@ export const transformUserInfoResponse = (userInfo: ServerUser): User => {
};

export const getUserInfo = async () => {
const userInfo = await getFetch<ServerUser>('/members/me');
const userInfo = await getFetch<UserInfoResponse>('/members/me');

return transformUserInfoResponse(userInfo);
};
4 changes: 2 additions & 2 deletions frontend/src/mocks/mockData/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { User } from '@type/user';
import { UserInfoResponse } from '@type/user';

export const MOCK_USER_INFO: User = {
export const MOCK_USER_INFO: UserInfoResponse = {
nickname: '우아한 코끼리',
postCount: 4,
voteCount: 128,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface User {
badge?: string;
}

export interface ServerUser {
export interface UserInfoResponse {
nickname: string;
userPoint: number;
postCount: number;
Expand Down

0 comments on commit 795c59d

Please sign in to comment.