43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
|
|
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) {
|
||
|
|
return await httpDeleteInterceptor(`/article-comments/${id}`);
|
||
|
|
}
|
||
|
|
|
||
|
|
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);
|
||
|
|
}
|