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

46 lines
1.1 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";
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");
export async function listUserRole(data: any) {
const headers = {
"content-type": "application/json",
};
2025-05-28 06:56:41 +00:00
return await httpGetInterceptor(
`/user-roles?limit=${data.limit}&page=${data.page}&timeStamp=${
data.timeStamp || ""
}`
);
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);
}