29 lines
619 B
JavaScript
29 lines
619 B
JavaScript
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 = "";
|
|
if (window.location.pathname.length > 4) {
|
|
ip = window.location.pathname.split("/")[1];
|
|
console.log(ip);
|
|
}
|
|
axios.get(`/json/${ip}`)
|
|
.then(response => {
|
|
this.dip = response.data
|
|
})
|
|
.catch(err => {
|
|
// Manage the state of the application if the request
|
|
// has failed
|
|
});
|
|
}
|
|
}); |