dip/static/js/main.js

29 lines
619 B
JavaScript
Raw Normal View History

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 () {
var ip = "";
2022-08-19 20:36:59 +02:00
if (window.location.pathname.length > 4) {
ip = window.location.pathname.split("/")[1];
2022-08-19 20:36:59 +02:00
console.log(ip);
}
2022-08-19 20:36:59 +02:00
axios.get(`/json/${ip}`)
.then(response => {
this.dip = response.data
})
.catch(err => {
// Manage the state of the application if the request
// has failed
});
}
});