gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s

This commit is contained in:
2026-04-15 08:59:36 +02:00
commit ab73d05ecc
359 changed files with 14415 additions and 0 deletions

31
resources/firebase.js Normal file
View File

@@ -0,0 +1,31 @@
// Request permission to receive notifications
messaging.requestPermission()
.then(() => messaging.getToken())
.then(token => {
console.log('====================');
console.log('FCM Token:', token);
console.log('====================');
// Send the token to the server to subscribe to notifications
fetch('/save-fcm-token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ token: token })
});
})
.catch(error => {
console.error('Error getting permission or token', error);
});
// Handle incoming messages
messaging.onMessage(payload => {
console.log('Message received. ', payload);
// Customize notification here
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
};
new Notification(notificationTitle, notificationOptions);
});