43 lines
1006 B
TypeScript
43 lines
1006 B
TypeScript
|
|
import {
|
||
|
|
httpDeleteInterceptor,
|
||
|
|
httpGet,
|
||
|
|
httpPost,
|
||
|
|
} from "./http-config/axios-base-service";
|
||
|
|
|
||
|
|
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
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
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",
|
||
|
|
};
|
||
|
|
return await httpDeleteInterceptor(`/user-roles/${id}`, headers);
|
||
|
|
}
|