Files
shop-front/src/app/product/service/Service.ts
T
hamid zarghami cb5a9a8e21 add question
2025-09-07 15:53:46 +03:30

27 lines
689 B
TypeScript

import axios from "@/config/axios";
import { ProductDetailResponse } from "@/types/product.types";
import { AddCommentProps, AddQuestionProps } from "../types/Types";
export const getProduct = async (
id: string
): Promise<ProductDetailResponse> => {
const { data } = await axios.get(`/product/${id}`);
return data;
};
export const addComment = async (params: AddCommentProps) => {
const { data } = await axios.post(
`/product/${params.productId}/comments`,
params
);
return data;
};
export const addQuestion = async (params: AddQuestionProps) => {
const { data } = await axios.post(
`/product/${params.productId}/questions`,
params
);
return data;
};