Limit device registration to customers only

This commit is contained in:
Ben Goldsworthy 2020-11-29 15:59:38 +00:00
parent 2d58603444
commit 5911c4d8ee
2 changed files with 5 additions and 4 deletions

View file

@ -12,8 +12,10 @@ export class AppComponent {
constructor(private messagingService: MessagingService) { }
ngOnInit() {
if (localStorage.getItem('usertype') === 'customer') {
this.messagingService.requestPermission();
this.messagingService.receiveMessage();
this.message = this.messagingService.currentMessage;
}
}
}

View file

@ -20,7 +20,6 @@ export class MessagingService {
requestPermission() {
this.angularFireMessaging.requestToken.subscribe((token) => {
console.log("Device token: " + token);
this.api.addDeviceToken({'token': token, 'email': localStorage.getItem('email')}).subscribe(
result => {
console.log("Device registered successfully!");