Notification code Refactory

This commit is contained in:
Eudes Inácio
2021-04-12 08:34:17 +01:00
parent 77accfd603
commit a187d3055b
3 changed files with 224 additions and 54 deletions
+1 -22
View File
@@ -81,28 +81,7 @@ export class LoginPage implements OnInit {
}
getToken() {
this.fcm.getToken().then(token => {
console.log('token: ', token)
this.storageService.store(this.username, token);
this.storageService.get(this.username).then(value => {
console.log('STORAGE TOKEN', value)
this.storageService.get(AuthConnstants.USER).then(res => {
console.log('USERID', res);
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
const body = {
UserId: res.UserId,
TokenId: token,
Status: 1,
Service: 1
};
this.http.post<Token>('https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/notifications/token', body, { headers }).subscribe(data => {
console.log('TOKEN USER MIDLE', data);
})
});
});
});
this.notificatinsservice.getAndpostToken(this.username)
}