web-humas-fe/services/user-levels/user-levels-service.ts

59 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-02-18 05:17:41 +00:00
import {
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
2025-05-04 07:14:12 +00:00
} from "@/services/http-config/axios-base-service";
2024-04-23 05:17:21 +00:00
2025-04-16 08:51:12 +00:00
import Cookies from "js-cookie";
const token = Cookies.get("access_token");
export async function getAllUserLevels(data?: any) {
2024-04-23 05:17:21 +00:00
const headers = {
"content-type": "application/json",
};
2025-02-26 17:12:10 +00:00
return await httpGet(
`user-levels?limit=${data?.limit || ""}&levelNumber=${
2025-02-26 17:12:10 +00:00
data?.levelNumber || ""
2025-03-06 10:40:54 +00:00
}&name=${data?.search || ""}&page=${data?.page || "1"}`,
2025-02-26 17:12:10 +00:00
headers
);
2025-02-18 05:17:41 +00:00
}
export async function getUserLevels(id: string) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`user-levels/${id}`, headers);
2024-04-23 05:17:21 +00:00
}
export async function getAccountById(id: string) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`user-account/findById/${id}`, headers);
}
export async function createUserLevels(request: any) {
const headers = {
"content-type": "application/json",
2025-08-29 06:43:53 +00:00
Authorization: `Bearer ${token}`,
2024-04-23 05:17:21 +00:00
};
return await httpPost(`user-levels`, headers, request);
}
2025-02-18 05:17:41 +00:00
export async function editUserLevels(id: string, request: any) {
const headers = {
"content-type": "application/json",
};
return await httpPut(`user-levels/${id}`, headers, request);
}
2025-04-16 08:51:12 +00:00
export async function changeIsApproval(request: any) {
const headers = {
"content-type": "application/json",
Authorization: `Bearer ${token}`,
};
return await httpPut(`user-levels/enable-approval`, headers, request);
}