Skip to content

Commit

Permalink
fixed after mentors review
Browse files Browse the repository at this point in the history
  • Loading branch information
OkMoroz committed Dec 23, 2024
1 parent 4c3d32c commit 2fa9e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/api/comments.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Comment, CommentData } from '../types/Comment';
import { client } from '../utils/fetchClient';
import { COMMENTS } from '../constans/comments';

export const getComments = (postId: number) => {
return client.get<Comment[]>(`/comments?postId=${postId}`);
return client.get<Comment[]>(`${COMMENTS}?postId=${postId}`);
};

export const deleteComment = (commentId: number) => {
return client.delete(`/comments/${commentId}`);
return client.delete(`${COMMENTS}${commentId}`);
};

export const addComment = (newComment: CommentData) => {
return client.post<Comment>('/comments', newComment);
return client.post<Comment>(`${COMMENTS}`, newComment);
};
1 change: 1 addition & 0 deletions src/constans/comments.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const COMMENTS = '/comments';

0 comments on commit 2fa9e06

Please sign in to comment.