public.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { get, post, del, put } from "../config/request";
  2. import axiosAPI from "../config/axios";
  3. import { createLog } from "./log";
  4. export const addPesertaPleno = async (token, data) => {
  5. try {
  6. const res = await axiosAPI.post('/public/sanksi/add-peserta-pleno', data, { headers: { Authorization: token } });
  7. return res.data;
  8. } catch (error) {
  9. console.log("error", error.response.data);
  10. return false;
  11. }
  12. };
  13. export const getOneLaporanPublic = async (id, query = {}) => {
  14. try {
  15. let url = `public/laporan/${id}`;
  16. if (query != null) {
  17. const { aktif, all } = query;
  18. url += "?";
  19. const parseURL = [];
  20. if (all) {
  21. parseURL.push(`all=true`);
  22. }
  23. if (aktif === false) {
  24. parseURL.push(`aktif=false`);
  25. }
  26. url += parseURL.join("&");
  27. }
  28. const res = await axiosAPI.get(url);
  29. return res.data;
  30. } catch (error) {
  31. console.log("error", error);
  32. return false;
  33. }
  34. };