web-humas-fe/services/master-user-level.ts

35 lines
870 B
TypeScript
Raw Normal View History

2025-08-29 06:43:53 +00:00
import Cookies from "js-cookie";
2025-02-06 13:14:11 +00:00
import {
httpDeleteInterceptor,
httpGet,
httpPost,
httpPut,
} from "./http-config/axios-base-service";
2025-08-29 06:43:53 +00:00
const token = Cookies.get("access_token");
2025-02-06 13:14:11 +00:00
export async function createUserLevel(data: any) {
const headers = {
"content-type": "application/json",
};
const pathUrl = `/user-levels`;
return await httpPost(pathUrl, headers, data);
}
export async function getUserLevel() {
const headers = {
"content-type": "application/json",
2025-08-29 06:43:53 +00:00
Authorization: `Bearer ${token}`,
2025-02-06 13:14:11 +00:00
};
return await httpGet(`/user-levels?levelNumber=2&parentLevelId=79`, headers);
}
export async function editUserLevel(data: any, id: number) {
const headers = {
"content-type": "application/json",
2025-08-29 06:43:53 +00:00
Authorization: `Bearer ${token}`,
2025-02-06 13:14:11 +00:00
};
const pathUrl = `/user-levels/${id}`;
return await httpPut(pathUrl, headers, data);
}