Add device token management
This commit is contained in:
parent
907fe6eab6
commit
113a100ba1
5 changed files with 43 additions and 14 deletions
|
@ -21,10 +21,10 @@ export class MessagingService {
|
|||
requestPermission() {
|
||||
this.angularFireMessaging.requestToken.subscribe((token) => {
|
||||
console.log("Device token: " + token);
|
||||
return
|
||||
this.api.addDeviceToken(token).subscribe(
|
||||
this.api.addDeviceToken({'token': token, 'email': localStorage.getItem('email')}).subscribe(
|
||||
result => {
|
||||
console.log("Device registered successfully!");
|
||||
localStorage.setItem('devicetoken', token);
|
||||
},
|
||||
error => {
|
||||
console.error("Device could not be registered!", error._body);
|
||||
|
|
Reference in a new issue