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

44 lines
1.0 KiB
TypeScript
Raw Normal View History

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";
const token = Cookies.get("access_token");
export async function listUserRole(data: any) {
const headers = {
"content-type": "application/json",
};
return await httpGet(
`/user-roles?limit=${data.limit}&page=${data.page}`,
headers
);
2024-04-24 10:41:04 +00:00
}
export async function createMasterUserRole(data: any) {
const headers = {
"content-type": "application/json",
2025-02-17 10:18:50 +00:00
Authorization: `Bearer ${token}`,
};
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) {
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);
}