Add device token management

This commit is contained in:
Ben Goldsworthy 2020-11-28 19:33:36 +00:00
parent e25ccfaff5
commit 35e2593aef
5 changed files with 43 additions and 14 deletions

View file

@ -13,10 +13,24 @@ export class SendPushNotificationComponent implements OnInit {
noEmail = false;
sendMessageFormStatus: any;
sendMessageFormStatusError = 'Error received, please try again.';
deviceTokenList: any;
deviceTokenIdList: any;
constructor(private api: ApiService) {
this.api.getDeviceTokens().subscribe(
result => {
console.log(result);
this.deviceTokenList = result.tokens;
this.deviceTokenIdList = Object.keys(this.deviceTokenList);
},
error => {
console.log("Couldn't get device token");
console.log(error._body);
}
);
this.sendMessageForm = new FormGroup({
messagetext: new FormControl('', Validators.required),
devicetokens: new FormControl('', Validators.required),
});
}