|
|
@@ -3,13 +3,17 @@ import axios2 from "axios";
|
|
|
|
|
|
export const createPengunjung = async () => {
|
|
|
try {
|
|
|
- const jsonip = await axios2.get("http://ip-api.com/json");
|
|
|
+ const jsonip = await axios2.get("https://ip-api.io/json");
|
|
|
const res = await axios.post("/pengunjung/create", {
|
|
|
os: navigator.userAgentData.platform,
|
|
|
- ipv4: jsonip.data.query,
|
|
|
+ ipv4: jsonip.data.ip,
|
|
|
location: {
|
|
|
- ...jsonip.data,
|
|
|
- region: jsonip.data.regionName,
|
|
|
+ country: { type: String },
|
|
|
+ region: jsonip.data.region_name,
|
|
|
+ city: jsonip.data.city,
|
|
|
+ lat: jsonip.data.latitude,
|
|
|
+ lon: jsonip.data.longitude,
|
|
|
+ timezone: jsonip.data.time_zone,
|
|
|
},
|
|
|
});
|
|
|
return res.data;
|