| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- // import { API_URL } from "@/env";
- import axios from "../config/axios";
- export const getPelanggaranId = async (id) => {
- try {
- const data = { id };
- const myHeaders = new Headers();
- myHeaders.append("Content-Type", "application/json");
- const raw = JSON.stringify(data);
- const requestOptions = {
- method: "POST",
- body: raw,
- headers: myHeaders,
- };
- const res = await fetch(API_URL + "/pelanggaran", requestOptions);
- return await res.json();
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
- export const getPelanggaran = async (token) => {
- try {
- const res = await axios.get("/pelanggaran", {
- headers: {
- Authorization: token,
- },
- });
- return await res.data;
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
- export const getPelanggaranPublic = async (token) => {
- try {
- const res = await axios.get("/public/pelanggaran");
- return await res.data;
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
|