From 28e9fd8e30a192ed75d6039f2dad2ff89ef10a4b Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Sun, 13 Nov 2022 20:00:29 +0100 Subject: [PATCH] added subscribe to topic --- frontend/app.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/app.vue b/frontend/app.vue index 7ee388d..4da6253 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -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) + }); } );