Ask questionsTypeError: Cannot read property 'error' of undefined failed_tokens example
When attempting to filter for the failed tokens after a send using the example in the documentation i keep getting the following
push\server.js:30
var failed_tokens = gcmdevices.filter((token, i) => response[i].error != null);
^
TypeError: Cannot read property 'error' of undefined
Answer
questions
medoix
var failed_tokens = response.results
.map((res, i) => res.error ? gcmdevices[i] : null)
.filter(token => token);
console.log('These tokens are no longer ok:', failed_tokens);
Related questions
No questions were found.