| 123456789101112131415161718192021222324252627282930313233 |
- import { API_URL } from "@/env";
- 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 () => {
- try {
- const res = await fetch(API_URL + "/pelanggaran");
- return await res.json();
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
|