27 lines
689 B
TypeScript
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;
|
|
};
|