import { get, post, del, put } from "../config/request"; import axiosAPI from "../config/axios"; import { createLog } from "./log"; import { getCsrf } from "./security"; export const addPesertaPleno = async (token, data) => { const getToken = await getCsrf(); const _csrf = getToken.token; try { const res = await axiosAPI.post(`/public/sanksi/add-peserta-pleno?_csrf=${_csrf}`, data, { headers: { Authorization: token } }); return res.data; } catch (error) { console.log("error", error.response.data); return false; } }; export const addDaftarHadirPeserta = async (token, data) => { const getToken = await getCsrf(); const _csrf = getToken.token; try { const res = await axiosAPI.post(`/signature?_csrf=${_csrf}`, data, { headers: { Authorization: token } }); return res.data; } catch (error) { console.log("error", error.response.data); return false; } }; export const getDaftarHadirPeserta = async (token, id, query = {}) => { try { let url = `/signature/${id}`; const res = await axiosAPI.get(url, { headers: { Authorization: token } }); return res.data; } catch (error) { console.log("error", error); return false; } }; export const getOneLaporanPublic = async (id, query = {}) => { try { let url = `public/laporan/${id}`; if (query != null) { const { aktif, all } = query; url += "?"; const parseURL = []; if (all) { parseURL.push(`all=true`); } if (aktif === false) { parseURL.push(`aktif=false`); } url += parseURL.join("&"); } const res = await axiosAPI.get(url); return res.data; } catch (error) { console.log("error", error); return false; } };