| 12345678910111213141516171819202122232425262728293031 |
- 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("http://localhost:5000/pelanggaran", requestOptions);
- return await res.json();
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
- export const getPelanggaran = async () => {
- try {
- const res = await fetch("http://localhost:5000/pelanggaran");
- return await res.json();
- } catch (error) {
- console.log("error", error);
- return false;
- }
- };
|