|
|
@@ -1,6 +1,6 @@
|
|
|
import { get } from "../config/request";
|
|
|
import axios from "@/config/axios";
|
|
|
-import ip from "ip";
|
|
|
+import axios2 from "axios";
|
|
|
import osValue from "../utils/osValue";
|
|
|
|
|
|
export const getLog = async (token, laporan_id) => {
|
|
|
@@ -44,8 +44,14 @@ export const getLogPublic = async ({ no_hp, no_laporan }) => {
|
|
|
};
|
|
|
|
|
|
export const createLog = async (token, data) => {
|
|
|
- const res = await axios.post("/log", { os: osValue(), ipv4: ip.address("public", "ipv4"), ...data }, { headers: { Authorization: token } });
|
|
|
- return res.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) => {
|