added subscribe to topic
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
xeovalyte 2022-11-13 20:00:29 +01:00
parent 4d3bdcbb6e
commit 28e9fd8e30

View File

@ -120,6 +120,22 @@ const setupNotifications = () => {
(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: currentToken })
}).then(response => response.json())
.then(response => {
console.log(response)
})
.catch(err => {
console.log(err)
});
}
);