[英]VueJS App and Firebase messaging error
Hi im trying to make push notifications work for my application but i cant seem to make it run with my Vue App 嗨,我试图使推送通知适用于我的应用程序,但我似乎无法使其与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').
无法注册ServiceWorker:脚本具有不受支持的MIME类型('text / html')。 (messaging/failed-serviceworker-registration)
(消息/失败-serviceworker注册)
I dont know how to handle it. 我不知道该如何处理。
This is my Main.js: 这是我的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() 这是我称之为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 很高兴知道我需要做什么
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.