import { get } from "../config/request"; import axios from "@/config/axios"; import axios2 from "axios"; import osValue from "../utils/osValue"; export const getLog = async (token, laporan_id) => { try { let url = `/pemantauan/${laporan_id}`; const res = await axios.get(url, { headers: { Authorization: token, }, }); return res.data; } catch (error) { console.log("error", error); return false; } }; export const getLogPT = async (token) => { try { let url = `/pemantauan/pt`; const res = await axios.get(url, { headers: { Authorization: token, }, }); return res.data; } catch (error) { console.log("error", error); return false; } }; export const getLogPublic = async ({ no_hp, no_laporan }) => { try { const res = await axios.get(`/public/pemantauan?no_hp=${no_hp}&no_laporan=${no_laporan}`); return res.data; } catch (error) { console.log("error", error); return false; } }; export const createLog = async (token, data) => { try { const jsonip = await axios2.get("https://jsonip.com", { mode: "cors" }); const res = await axios.post("/log", { os: window.navigator.platform, ipv4: jsonip.data.ip, ...data }, { headers: { Authorization: token } }); return res.data; } catch (error) { console.log("error", error); return false; } }; export const getLogAdmin = async (token) => { try { const res = await axios.get(`/log`, { headers: { Authorization: token } }); return res.data; } catch (error) { console.log("error", error); return false; } };