2020-03-10 14:58:59 +01:00
|
|
|
var vue = new Vue({
|
|
|
|
el: '#dip_main_div',
|
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
title: "Public IP Address service",
|
|
|
|
dip: {"ip": null,
|
|
|
|
"hostname": null,
|
|
|
|
"city": null,
|
|
|
|
"country": null},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted () {
|
2022-08-18 01:16:43 +02:00
|
|
|
var ip = "";
|
2022-08-19 20:36:59 +02:00
|
|
|
if (window.location.pathname.length > 4) {
|
2022-08-18 01:16:43 +02:00
|
|
|
ip = window.location.pathname.split("/")[1];
|
2022-08-19 20:36:59 +02:00
|
|
|
console.log(ip);
|
2022-08-18 01:16:43 +02:00
|
|
|
}
|
2022-08-19 20:36:59 +02:00
|
|
|
axios.get(`/json/${ip}`)
|
2020-03-10 14:58:59 +01:00
|
|
|
.then(response => {
|
|
|
|
this.dip = response.data
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
// Manage the state of the application if the request
|
|
|
|
// has failed
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|