Recently delved into Vue and not exactly a fan of Javascript, so I've set up a Vue component that uses Axios to fetch some data. However, I'm struggling to display this data in my form elements.
I have Axios intercepting the response and retrieving the necessary data:
methods: {
},
mounted: function() {
axios.interceptors.response.use(function (response) {
return response.data;
});
},
destroyed: function() {
}
}
The above code is executed on page load, and here's what I have in my data section:
data() {
return {
formpersonaldetails: {},
title: this.results.title,
titleoptions: ['Mr', 'Mrs', 'Miss', 'Ms'],
fname: this.results.fname,
sname: this.results.sname,
dob: this.results.dob,
However, as you can tell, this approach doesn't seem to be working. Can someone point out where I might be making a mistake?
Here's how the response data looks like:
{"id":2,"user_id":null,"fname":"Graham","sname":"Morby-Raybould","dob":"1982-07-10T08:22:00.000Z","gender":"Male","nationality":"British","mobile":null,"telephone":null,"hname":"","address2":"","address3":"","postcode":"","noktitle":"","nokfname":"","noksname":"","nokcontactnumber":"","nokhname":"","nokaddress2":"","nokaddress3":"","nokpostcode":"","emp_type":"","trade":"","ninumber":"","utrnumber":"","vatreg":null,"vatcert":"","created_at":"2017-10-10 08:22:37","updated_at":"2017-10-10 08:22:37"}