Hey, I guess you are trying to send the request from the service worker and not from the app itself, as far as I know you can't access axios inside service workers - but you can use fetch instead:
axios
fetch
//firebase-messaging-sw.js ... messaging.getToken({ vapidKey: <KEY> }).then((currentToken) => { if (currentToken) { fetch('http://some.api', { method: 'GET', }) .then(function (data) { console.log('Request Succeeded: ', data); }) .catch(function (error) { console.log('Request Failed: ', error); }); } ...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey,
I guess you are trying to send the request from the service worker and not from the app itself, as far as I know you can't access
axios
inside service workers - but you can usefetch
instead: