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

46 lines
1.1 KiB
TypeScript

import {
httpDeleteInterceptor,
httpGet,
httpPost,
} from "./http-config/axios-base-service";
import Cookies from "js-cookie";
import { httpGetInterceptor } from "./http-config/http-interceptor-services";
const token = Cookies.get("access_token");
export async function listUserRole(data: any) {
const headers = {
"content-type": "application/json",
};
return await httpGetInterceptor(
`/user-roles?limit=${data.limit}&page=${data.page}&timeStamp=${
data.timeStamp || ""
}`
);
}
export async function createMasterUserRole(data: any) {
const headers = {
"content-type": "application/json",
Authorization: `Bearer ${token}`,
};
const pathUrl = `/user-roles`;
return await httpPost(pathUrl, headers, data);
}
export async function getMasterUserRoleById(id: any) {
const headers = {
"content-type": "application/json",
};
return await httpGet(`/user-roles/${id}`, headers);
}
export async function deleteMasterUserRole(id: string) {
const headers = {
"content-type": "application/json",
Authorization: `Bearer ${token}`,
};
return await httpDeleteInterceptor(`/user-roles/${id}`, headers);
}