export const getLog = async () => {
	try {
		const res = await fetch("http://localhost:5000/log");
		return await res.json();
	} catch (error) {
		console.log("error", error);
		return false;
	}
};

export const addLog = async (data) => {
	try {
		const myHeaders = new Headers();
		myHeaders.append("Content-Type", "application/json");

		const raw = JSON.stringify(data);

		const requestOptions = {
			method: "POST",
			body: raw,
			headers: myHeaders,
		};

		const updated = await fetch(`http://localhost:5000/log/add`, requestOptions);
		return await updated.json();
	} catch (error) {
		console.log("error", error);
		return false;
	}
};
