new changes

This commit is contained in:
Mamalizz
2025-02-23 23:21:41 +03:30
parent eadcfcdc61
commit 1dcd3647ac
8 changed files with 129 additions and 109 deletions
@@ -6,24 +6,27 @@ import { API_ENDPOINTS } from "~/constants";
// types
export type CreateCommentRequest = {
content: string
content: string;
};
const useCreateComment = (id: number | string | undefined) => {
// state
const { $axios: axios } = useNuxtApp();
// method
// methods
const handleCreateComment = async (variables: CreateCommentRequest) => {
const { data } = await axios.post(`${API_ENDPOINTS.product.create_comment}/${id}`, variables);
const { data } = await axios.post(
`${API_ENDPOINTS.product.create_comment}/${id}`,
variables
);
return data;
};
return useMutation({
mutationFn: (variables: CreateCommentRequest) => handleCreateComment(variables)
mutationFn: (variables: CreateCommentRequest) =>
handleCreateComment(variables),
});
};