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 = { 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/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/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; 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..e78f175 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,3 +1,5 @@ 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; +};