| 123456789101112131415161718192021222324252627282930 | import { addLog } from "./log";export const getPelaporan = async (query = {}) => {	try {		let url = "http://localhost:5000/pelaporan";		if (query.ptId && query.number) url += `?number=${query.number}&ptId=${query.ptId}`;		if (query.penjadwalan) url += "?penjadwalan=true";		if (query.pemeriksaan) url += "?pemeriksaan=true";		const res = await fetch(url);		return await res.json();	} catch (error) {		console.log("error", error);		return false;	}};export const createPelaporan = async (data) => {	try {		const res = await fetch("http://localhost:5000/pelaporan/create", {			method: "POST",			body: data,		});		const result = await res.json();		addLog({ status: "SUCCESS", action: "CREATE", from: { id: result.created._id, data: "pelaporan" }, description: "membuat laporan" });		return result;	} catch (error) {		addLog({ status: "FAIL", action: "CREATE", from: { data: "pelaporan" }, description: error.message || "membuat laporan" });		return false;	}};
 |