/push/:msgtoken sendet Push
This commit is contained in:
		@@ -1,24 +1,22 @@
 | 
			
		||||
 | 
			
		||||
// Initialize Firebase
 | 
			
		||||
// const firebaseconfig = {
 | 
			
		||||
//   apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
 | 
			
		||||
//   authDomain: "test-667ca.firebaseapp.com",
 | 
			
		||||
//   databaseURL: "https://test-667ca.firebaseio.com",
 | 
			
		||||
//   projectId: "test-667ca",
 | 
			
		||||
//   storageBucket: "test-667ca.appspot.com",
 | 
			
		||||
//   messagingSenderId: "221332577314"
 | 
			
		||||
// };
 | 
			
		||||
// firebase.initializeApp(firebaseconfig);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// var admin = require("firebase-admin");
 | 
			
		||||
 | 
			
		||||
// var serviceAccount = require("firebaseAdminKey.json");
 | 
			
		||||
 | 
			
		||||
// admin.initializeApp({
 | 
			
		||||
//   credential: admin.credential.cert(serviceAccount),
 | 
			
		||||
//   databaseURL: "https://test-667ca.firebaseio.com"
 | 
			
		||||
// });
 | 
			
		||||
 | 
			
		||||
var msg = firebase.messaging();
 | 
			
		||||
msg.requestPermission()
 | 
			
		||||
.then(function(){
 | 
			
		||||
    console.log("Zugriff auf msg");
 | 
			
		||||
    
 | 
			
		||||
    return msg.getToken();
 | 
			
		||||
})
 | 
			
		||||
.then(token => {
 | 
			
		||||
    console.log("Zugriff auf msg", token);
 | 
			
		||||
    updateUser(token);
 | 
			
		||||
    
 | 
			
		||||
})
 | 
			
		||||
@@ -26,6 +24,7 @@ msg.requestPermission()
 | 
			
		||||
    console.error("Msg Error: ", err);
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function updateUser(token) {
 | 
			
		||||
  firebase.auth().onAuthStateChanged(function(user){if(user){firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idtoken) {
 | 
			
		||||
      $.ajax({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user