Hi im trying to make push notifications work for my application but i cant seem to make it run with my Vue App
I keep getting this error:
Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html'). (messaging/failed-serviceworker-registration)
I dont know how to handle it.
This is my Main.js:
let config = {
apiKey: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
authDomain: 'vue-notify.firebaseapp.com',
databaseURL: 'https://vue-notify.firebaseio.com',
projectId: 'vue-notify',
storageBucket: 'vue-notify.appspot.com',
messagingSenderId: 'xxxxxxxxxxxxxxxxxxxxxx'
}
firebase.initializeApp(config)
This is the function in a component where I call the firebase.messaging()
subscribe () {
firebase.messaging().requestPermission().then(() => firebase.messaging().getToken())
.then((token) => console.log(token))
.catch((err) => console.log(err))
}
Would be nice to know what i need to do
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.