web-humas-fe/service/comment.ts

46 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-03-06 14:58:38 +00:00
import {
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
} from "./http-config/axios-base-service";
import Cookies from "js-cookie";
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 httpGet(pathUrl, headers);
}
export async function deleteComment(id: number) {
2025-03-18 08:30:18 +00:00
const headers = {
"content-type": "application/json",
};
return await httpDeleteInterceptor(`/article-comments/${id}`, headers);
2025-03-06 14:58:38 +00:00
}
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",
};
const pathUrl = `/article-comments/approval`;
return await httpPost(pathUrl, headers, data);
}