49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import {
|
|
httpDeleteInterceptor,
|
|
httpGet,
|
|
httpPost,
|
|
httpPut,
|
|
} from "./http-config/axios-base-service";
|
|
import Cookies from "js-cookie";
|
|
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
|
|
|
const token = Cookies.get("access_token");
|
|
|
|
export async function getComments(data: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
const pathUrl = `/article-comments?page=${data?.page || 1}&limit=${
|
|
data?.limit || ""
|
|
}&message=${data?.search || ""}&parentId=0`;
|
|
return await httpGetInterceptor(pathUrl);
|
|
}
|
|
|
|
export async function deleteComment(id: number) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
|
|
}
|
|
|
|
export async function getCommentById(id: number) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
const pathUrl = `/article-comments/${id}`;
|
|
return await httpGet(pathUrl, headers);
|
|
}
|
|
|
|
export async function saveCommentStatus(data: {
|
|
id: number;
|
|
statusId: number;
|
|
}) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
const pathUrl = `/article-comments/approval`;
|
|
return await httpPost(pathUrl, headers, data);
|
|
}
|