move firebase credentials to a separate file

This commit is contained in:
or-else
2018-09-24 12:37:35 +03:00
parent 3ad8274ad8
commit c8a47efde2
6 changed files with 34 additions and 30 deletions
+5 -12
View File
@@ -1,16 +1,9 @@
// Must be located at the root.
'use strict';
importScripts("https://unpkg.com/firebase@5.5.1/firebase-app.js");
importScripts("https://unpkg.com/firebase@5.5.1/firebase-messaging.js");
importScripts("/firebase-init.js")
importScripts("https://unpkg.com/firebase@5.5.0/firebase-app.js");
importScripts("https://unpkg.com/firebase@5.5.0/firebase-messaging.js");
const FIREBASE_PUBLIC_API_KEY = "AIzaSyD6X4ULR-RUsobvs1zZ2bHdJuPz39q2tbQ";
const FIREBASE_SENDER_ID = "114126160546";
firebase.initializeApp({
apiKey: FIREBASE_PUBLIC_API_KEY,
messagingSenderId: FIREBASE_SENDER_ID
});
firebase.initializeApp(FIREBASE_INIT);
firebase.messaging().setBackgroundMessageHandler(function(payload) {
let title = payload.notification.title || "New message";
@@ -19,6 +12,6 @@ firebase.messaging().setBackgroundMessageHandler(function(payload) {
icon: '/img/logo96.png'
};
console.log("background message", payload);
return self.registration.showNotification(title, options);
});