62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import {
|
|
httpDeleteInterceptor,
|
|
httpGet,
|
|
httpPost,
|
|
httpPut,
|
|
} from "@/services/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 getAllUserLevels(data?: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
|
|
return await httpGetInterceptor(
|
|
`user-levels?limit=${data?.limit || ""}&levelNumber=${
|
|
data?.levelNumber || ""
|
|
}&name=${data?.search || ""}&page=${data?.page || "1"}&timeStamp=${
|
|
data?.timeStamp || ""
|
|
}`
|
|
);
|
|
}
|
|
export async function getUserLevels(id: string) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpGet(`user-levels/${id}`, headers);
|
|
}
|
|
|
|
export async function getAccountById(id: string) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpGet(`user-account/findById/${id}`, headers);
|
|
}
|
|
|
|
export async function createUserLevels(request: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
return await httpPost(`user-levels`, headers, request);
|
|
}
|
|
|
|
export async function editUserLevels(id: string, request: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
};
|
|
return await httpPut(`user-levels/${id}`, headers, request);
|
|
}
|
|
|
|
export async function changeIsApproval(request: any) {
|
|
const headers = {
|
|
"content-type": "application/json",
|
|
Authorization: `Bearer ${token}`,
|
|
};
|
|
return await httpPut(`user-levels/enable-approval`, headers, request);
|
|
}
|