3👍
✅
Replace your
...
.then(function (response) {
console.log('success');
this.testFunction();
})
...
by
...
.then(response => {
console.log(response);
this.testFunction();
})
...
To avoid context override.
You can also use this code:
...
.then(function (response) {
console.log(response);
this.testFunction();
}.bind(this))
...
Or
...
const that = this;
...
.this(function (response) {
console.log(response);
that.testFunction();
})
...
Source:stackexchange.com