// dip service var dip = new Vue({ el: '#dip', data () { return { title: "Public IP Address Service", dipjson: {"ip": null, "hostname": null, "city": null, "country": null}, autorefresh: false, interval: null, } }, mounted () { this.updateIP(); this.runTimer(); }, methods: { updateIP: function () { axios.get("https://ip.paulbsd.com/json") .then(response => { this.dipjson = response.data; }) .catch(err => { // Manage the state of the application if the request // has failed }); }, runTimer: function () { if (this.autorefresh) { this.interval = setInterval(this.updateIP,10000); } } } } );