Refactor: further refactoring of api requests.

This commit is contained in:
Aaron William Po
2023-12-25 14:26:35 -05:00
parent 0e99782557
commit 623855682b
10 changed files with 152 additions and 81 deletions

View File

@@ -10,7 +10,7 @@ import createErrorToast from '@/util/createErrorToast';
import BeerStyleQueryResult from '@/services/posts/beer-style-post/schema/BeerStyleQueryResult';
import useBeerStyleComments from '@/hooks/data-fetching/beer-style-comments/useBeerStyleComments';
import sendCreateBeerStyleCommentRequest from '@/requests/comments/beer-style-comment/sendCreateBeerStyleCommentRequest';
import { sendCreateBeerStyleCommentRequest } from '@/requests/comments/beer-style-comment';
import CommentForm from '../ui/CommentForm';
interface BeerCommentFormProps {
@@ -35,8 +35,7 @@ const BeerStyleCommentForm: FunctionComponent<BeerCommentFormProps> = ({
const loadingToast = toast.loading('Posting a new comment...');
try {
await sendCreateBeerStyleCommentRequest({
content: data.content,
rating: data.rating,
body: { content: data.content, rating: data.rating },
beerStyleId: beerStyle.id,
});
reset();