2024-12-02 13:19:30 +00:00
|
|
|
import {
|
|
|
|
|
httpDeleteInterceptor,
|
|
|
|
|
httpGet,
|
|
|
|
|
httpPost,
|
|
|
|
|
} from "./http-config/axios-base-service";
|
2024-04-24 10:41:04 +00:00
|
|
|
|
2025-02-17 10:18:50 +00:00
|
|
|
import Cookies from "js-cookie";
|
2025-05-28 06:56:41 +00:00
|
|
|
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
|
2025-02-17 10:18:50 +00:00
|
|
|
|
|
|
|
|
const token = Cookies.get("access_token");
|
|
|
|
|
|
2024-12-02 13:19:30 +00:00
|
|
|
export async function listUserRole(data: any) {
|
|
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
2025-05-28 06:56:41 +00:00
|
|
|
return await httpGetInterceptor(
|
2026-02-03 15:34:40 +00:00
|
|
|
`/user-roles?limit=${data.limit}&page=${data.page}`,
|
2024-12-02 13:19:30 +00:00
|
|
|
);
|
2024-04-24 10:41:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function createMasterUserRole(data: any) {
|
2024-12-02 13:19:30 +00:00
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
2025-02-17 10:18:50 +00:00
|
|
|
Authorization: `Bearer ${token}`,
|
2024-12-02 13:19:30 +00:00
|
|
|
};
|
|
|
|
|
const pathUrl = `/user-roles`;
|
|
|
|
|
return await httpPost(pathUrl, headers, data);
|
2024-04-24 10:41:04 +00:00
|
|
|
}
|
|
|
|
|
|
2024-04-24 15:25:37 +00:00
|
|
|
export async function getMasterUserRoleById(id: any) {
|
2024-12-02 13:19:30 +00:00
|
|
|
const headers = {
|
|
|
|
|
"content-type": "application/json",
|
|
|
|
|
};
|
|
|
|
|
return await httpGet(`/user-roles/${id}`, headers);
|
2024-04-24 15:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
2024-04-24 10:41:04 +00:00
|
|
|
export async function deleteMasterUserRole(id: string) {
|
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(`/user-roles/${id}`, headers);
|
2024-12-02 13:19:30 +00:00
|
|
|
}
|