| 123456789101112131415161718192021222324252627282930 |
- 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;
- }
- };
|