I have the followwing two methods in an vuejs
component:
openLender: function(setUrl) {
const win = window.open(setUrl, '_blank');
win.focus();
},
getLender: function(setEnt, setEx, setRev, setCred, setDur, checkWishes, lender) {
const vm = this;
const request = 'lender_click';
const setWishes = vm.arrayToString(checkWishes);
axios({
method:'get',
url:'/api',
params: {
request: request,
setent: setEnt,
setex: setEx,
setrev: setRev,
setcred: setCred,
setdur: setDur,
setwishes: setWishes,
setlender: lender
},
responseType:'json'
})
.then(function(response) {
const url = response.data;
vm.openLender(url[0].response);
})
.catch(function(error) {
alert(error);
});
}
The problem is that i get this error:
TypeError: Cannot read property 'focus' of null
When I console.log(url[0].response)
the response, it does show me the url that I got from the axios
request, but when I use the openLender()
method it gives me this error.
Any thoughts?
EDIT
I used @IgorDymov his solution in this post to work-around this problem