From aa0880b8d83322511f2e051d5e8e6f2418863b16 Mon Sep 17 00:00:00 2001 From: younoah Date: Tue, 15 Mar 2022 13:01:46 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor=20:=20userApi=20=EC=9D=91=EB=8B=B5?= =?UTF-8?q?=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=83=80=EC=9E=85=20=EC=A7=80?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apis/auth.ts b/src/apis/auth.ts index 6fc5c72..2fd193b 100644 --- a/src/apis/auth.ts +++ b/src/apis/auth.ts @@ -7,7 +7,7 @@ interface UserApiType { name: string; email: string; password: string; - }) => Promise; + }) => Promise>; login: (userInfo: { email: string; password: string; @@ -19,7 +19,7 @@ interface UserApiType { }: { name?: string; password?: string; - }) => Promise; + }) => Promise>; } const userApi: UserApiType = { From 96f64402692751e513197a4fa1d6f7dbcdfc1858 Mon Sep 17 00:00:00 2001 From: younoah Date: Tue, 15 Mar 2022 13:04:41 +0900 Subject: [PATCH 2/4] =?UTF-8?q?refactor:=20=EC=99=80=ED=94=8C=EC=B9=B4?= =?UTF-8?q?=EB=93=9C=20API=20=EC=9D=91=EB=8B=B5=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=ED=83=80=EC=9E=85=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/waffleCard.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/apis/waffleCard.ts b/src/apis/waffleCard.ts index d38c62c..8b830c6 100644 --- a/src/apis/waffleCard.ts +++ b/src/apis/waffleCard.ts @@ -13,10 +13,9 @@ interface WaffleCardApiType { emoji, color, hashTags, - }: Pick< - WaffleCardType, - 'emoji' | 'color' | 'hashTags' - >) => Promise; + }: Pick) => Promise< + AxiosResponse + >; updateWaffleCard: ( waffleCardId: string, { @@ -24,7 +23,7 @@ interface WaffleCardApiType { color, hashTags, }: Pick, - ) => Promise; + ) => Promise>; deleteWaffleCard: ( waffleCardId: Pick, ) => Promise; From d19d79eaaa5cec01ad2c63b515afd15498119821 Mon Sep 17 00:00:00 2001 From: younoah Date: Tue, 15 Mar 2022 13:09:52 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor=20:=20CommentType=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20comment=20api=20=EC=9D=91=EB=8B=B5=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=83=80=EC=9E=85=20=EB=AA=85?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/comment.ts | 17 +++++++++++++---- src/types/comment.ts | 11 +++++++++++ src/types/index.ts | 1 + 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/types/comment.ts diff --git a/src/apis/comment.ts b/src/apis/comment.ts index ae7b610..483ab24 100644 --- a/src/apis/comment.ts +++ b/src/apis/comment.ts @@ -1,11 +1,20 @@ import { AxiosResponse } from 'axios'; import { request, authRequest } from './request'; +import { CommentType } from '@/types'; interface CommentApiType { - getCommentsByWaffleCardId: (waffleCardId: string) => Promise; - getCommentById: (id: string) => Promise; - createComment: (waffleCardId: string, text: string) => Promise; - updateComment: (id: string, text: string) => Promise; + getCommentsByWaffleCardId: ( + waffleCardId: string, + ) => Promise>; + getCommentById: (id: string) => Promise>; + createComment: ( + waffleCardId: string, + text: string, + ) => Promise>; + updateComment: ( + id: string, + text: string, + ) => Promise>; deleteComment: (id: string) => Promise; } diff --git a/src/types/comment.ts b/src/types/comment.ts new file mode 100644 index 0000000..56463c9 --- /dev/null +++ b/src/types/comment.ts @@ -0,0 +1,11 @@ +export type CommentType = { + id: string; + user: { + id: string; + name: string; + }; + waffleCardId: string; + text: string; + createdAt: string; + updatedAt: string; +}; diff --git a/src/types/index.ts b/src/types/index.ts index f2b3080..4e5419e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,4 @@ export type { UserType } from './user'; export type { WaffleCardType } from './waffleCard'; export type { ModalsStateType } from './modals'; +export type { CommentType } from './comment'; From 862d967d2e868feda66442ed71ede8f3b8213b2b Mon Sep 17 00:00:00 2001 From: younoah Date: Tue, 15 Mar 2022 13:11:40 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor=20:=20LikeType=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20=EC=A2=8B=EC=95=84=EC=9A=94=20api=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/like.ts | 3 ++- src/types/index.ts | 1 + src/types/like.ts | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 src/types/like.ts diff --git a/src/apis/like.ts b/src/apis/like.ts index aad49bc..e286339 100644 --- a/src/apis/like.ts +++ b/src/apis/like.ts @@ -1,8 +1,9 @@ import { AxiosResponse } from 'axios'; import { authRequest } from './request'; +import { LikeType } from '@/types'; interface LikeApiType { - createLike: (waffleCardId: string) => Promise; + createLike: (waffleCardId: string) => Promise>; deleteLike: (waffleCardId: string) => Promise; } diff --git a/src/types/index.ts b/src/types/index.ts index 4e5419e..e78f175 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -2,3 +2,4 @@ export type { UserType } from './user'; export type { WaffleCardType } from './waffleCard'; export type { ModalsStateType } from './modals'; export type { CommentType } from './comment'; +export type { LikeType } from './like'; diff --git a/src/types/like.ts b/src/types/like.ts new file mode 100644 index 0000000..8c5d74e --- /dev/null +++ b/src/types/like.ts @@ -0,0 +1,5 @@ +export type LikeType = { + id: string; + userId: string; + waffleCardId: string; +};