0👍
✅
The problem is your scope of this
. You’re actually getting an error, cannot read property valid of undefined
, but you didn’t console.log(error)
. You need to use the fat arrow function
in your .then()
as well:
.then(function(response) {
to
.then((response) => {
Now this
is scoped correctly.
Source:stackexchange.com