Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/apis/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface UserApiType {
name: string;
email: string;
password: string;
}) => Promise<AxiosResponse>;
}) => Promise<AxiosResponse<UserType>>;
login: (userInfo: {
email: string;
password: string;
Expand All @@ -19,7 +19,7 @@ interface UserApiType {
}: {
name?: string;
password?: string;
}) => Promise<AxiosResponse>;
}) => Promise<AxiosResponse<UserType>>;
}

const userApi: UserApiType = {
Expand Down
17 changes: 13 additions & 4 deletions src/apis/comment.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { AxiosResponse } from 'axios';
import { request, authRequest } from './request';
import { CommentType } from '@/types';

interface CommentApiType {
getCommentsByWaffleCardId: (waffleCardId: string) => Promise<AxiosResponse>;
getCommentById: (id: string) => Promise<AxiosResponse>;
createComment: (waffleCardId: string, text: string) => Promise<AxiosResponse>;
updateComment: (id: string, text: string) => Promise<AxiosResponse>;
getCommentsByWaffleCardId: (
waffleCardId: string,
) => Promise<AxiosResponse<CommentType[]>>;
getCommentById: (id: string) => Promise<AxiosResponse<CommentType>>;
createComment: (
waffleCardId: string,
text: string,
) => Promise<AxiosResponse<CommentType>>;
updateComment: (
id: string,
text: string,
) => Promise<AxiosResponse<CommentType>>;
deleteComment: (id: string) => Promise<AxiosResponse>;
}

Expand Down
3 changes: 2 additions & 1 deletion src/apis/like.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { AxiosResponse } from 'axios';
import { authRequest } from './request';
import { LikeType } from '@/types';

interface LikeApiType {
createLike: (waffleCardId: string) => Promise<AxiosResponse>;
createLike: (waffleCardId: string) => Promise<AxiosResponse<LikeType>>;
deleteLike: (waffleCardId: string) => Promise<AxiosResponse>;
}

Expand Down
9 changes: 4 additions & 5 deletions src/apis/waffleCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,17 @@ interface WaffleCardApiType {
emoji,
color,
hashTags,
}: Pick<
WaffleCardType,
'emoji' | 'color' | 'hashTags'
>) => Promise<AxiosResponse>;
}: Pick<WaffleCardType, 'emoji' | 'color' | 'hashTags'>) => Promise<
AxiosResponse<WaffleCardType>
>;
updateWaffleCard: (
waffleCardId: string,
{
emoji,
color,
hashTags,
}: Pick<WaffleCardType, 'emoji' | 'color' | 'hashTags'>,
) => Promise<AxiosResponse>;
) => Promise<AxiosResponse<WaffleCardType>>;
deleteWaffleCard: (
waffleCardId: Pick<WaffleCardType, 'id'>,
) => Promise<AxiosResponse>;
Expand Down
11 changes: 11 additions & 0 deletions src/types/comment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export type CommentType = {
id: string;
user: {
id: string;
name: string;
};
waffleCardId: string;
text: string;
createdAt: string;
updatedAt: string;
};
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
@@ -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';
5 changes: 5 additions & 0 deletions src/types/like.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type LikeType = {
id: string;
userId: string;
waffleCardId: string;
};