| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | 
							- import { get } from "../config/request";
 
- import axiosAPI from "../config/axios";
 
- import { createLog } from "./log";
 
- import { getCsrf } from "./security";
 
- export const login = async (username, password) => {
 
- 	const data = {
 
- 		username,
 
- 		password,
 
- 	};
 
- 	const response = await axiosAPI.post("/auth/login", data, {
 
- 		headers: {
 
- 			"Content-Type": "application/json",
 
- 		},
 
- 	});
 
- 	return response.data;
 
- };
 
- export const refreshToken = async () => {
 
- 	try {
 
- 		const response = await axiosAPI.get("/token");
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
- export const getUser = async () => {
 
- 	try {
 
- 		const response = await get("/user");
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
- export const logout = async (_csrf) => {
 
- 	try {
 
- 		const response = await axiosAPI.delete(`/auth/logout?_csrf=${_csrf}`);
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
- export const loginToPt = async (lembaga_id, password, _csrf) => {
 
- 	const data = {
 
- 		lembaga_id,
 
- 		password,
 
- 	};
 
- 	const response = await axiosAPI.post(`/auth/login-to-pt?_csrf=${_csrf}`, data, {
 
- 		headers: {
 
- 			"Content-Type": "application/json",
 
- 		},
 
- 	});
 
- 	return response.data;
 
- };
 
- export const getkontakpt = async () => {
 
- 	try {
 
- 		const response = await get("/kontak");
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
- export const createotp = async (data, token) => {
 
- 	try {
 
- 		const response = await axiosAPI.post(`/auth/otp`, data, { headers: { Authorization: token } });
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
- export const createkontak = async (data, token) => {
 
- 	try {
 
- 		const response = await axiosAPI.post(`/kontak`, data, { headers: { Authorization: token } });
 
- 		return response.data;
 
- 	} catch (error) {
 
- 		if (error.response) return error.response.data;
 
- 	}
 
- };
 
 
  |