Merge branch 'main' of https://gitea.xeovalyte.dev/xeovalyte/wrbapp
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

merging
This commit is contained in:
Xeovalyte 2022-11-14 14:22:48 +01:00
commit 56fe3bc549
2 changed files with 21 additions and 3 deletions

View File

@ -32,6 +32,7 @@ const route = useRoute()
const isAuthenticated = ref(false)
const user = ref('frikandel')
const registrationToken = ref('')
const auth = ref(null)
const userLoaded = ref(false)
const userData = ref(null)
@ -121,6 +122,23 @@ const setupNotifications = () => {
PushNotifications.addListener('registration',
(token) => {
// alert('Push registration success, token: ' + token.value);
registrationToken.value = token
fetch('https://api.xeovalyte.com/subscribetotopic', {
method: 'POST',
headers: {
Authorization: 'Basic WGVvdmFseXRlOmtNKjhuRXMzNTchalJlXm1KYnZrRSFOIw==',
'content-type': 'application/json'
},
body: JSON.stringify({ topic: 'all', registrationToken: token.value })
}).then(response => response.json())
.then(response => {
console.log(response)
})
.catch(err => {
console.log(err)
});
}
);
@ -226,5 +244,5 @@ const logDeviceInfo = async () => {
const ledenlijst = ref([])
provide('firebase', { db, ledenlijst, isAuthenticated, user, userData, userPersons, auth, userAllPersons, getPersons, calEvents, news })
</script>
provide('firebase', { db, ledenlijst, isAuthenticated, user, userData, userPersons, auth, userAllPersons, getPersons, calEvents, news, registrationToken })
</script>

View File

@ -27,5 +27,5 @@ definePageMeta({
title: 'Home',
})
const { userPersons } = inject('firebase')
const { userPersons, registrationToken } = inject('firebase')
</script>