web-humas-fe/services/feedbacks.ts

46 lines
1.2 KiB
TypeScript
Raw Normal View History

2025-03-06 10:40:54 +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 createFeedback(data: any) {
const headers = {
"content-type": "application/json",
2025-08-29 06:43:53 +00:00
Authorization: `Bearer ${token}`,
2025-03-06 10:40:54 +00:00
};
const pathUrl = `/feedbacks`;
return await httpPost(pathUrl, headers, data);
}
export async function getFeedbacks(data: any) {
const headers = {
"content-type": "application/json",
};
2025-03-06 14:58:38 +00:00
const pathUrl = `/feedbacks?page=${data?.page || 1}limit=${
data?.limit || ""
2025-04-28 12:42:40 +00:00
}&message=${data?.search || ""}&startDate=${data.startDate || ""}&endDate=${
data.endDate || ""
}`;
2025-03-06 10:40:54 +00:00
return await httpGet(pathUrl, headers);
}
export async function getFeedbacksById(id: number) {
const headers = {
"content-type": "application/json",
};
const pathUrl = `/feedbacks/${id}`;
return await httpGet(pathUrl, headers);
}
2025-03-06 14:58:38 +00:00
export async function deleteFeedback(id: number) {
2025-03-18 08:30:18 +00:00
const headers = {
"content-type": "application/json",
2025-08-29 06:43:53 +00:00
Authorization: `Bearer ${token}`,
2025-03-18 08:30:18 +00:00
};
return await httpDeleteInterceptor(`/feedbacks/${id}`, headers);
2025-03-06 14:58:38 +00:00
}