From 83fa5449b8c91cb1a366169d98ec64a42f0c447e Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Sun, 29 Nov 2020 15:59:38 +0000 Subject: [PATCH] Limit device registration to customers only --- src/app/app.component.ts | 8 +++++--- src/app/service/messaging.service.ts | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index a8ded8b..76d9e17 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -12,8 +12,10 @@ export class AppComponent { constructor(private messagingService: MessagingService) { } ngOnInit() { - this.messagingService.requestPermission(); - this.messagingService.receiveMessage(); - this.message = this.messagingService.currentMessage; + if (localStorage.getItem('usertype') === 'customer') { + this.messagingService.requestPermission(); + this.messagingService.receiveMessage(); + this.message = this.messagingService.currentMessage; + } } } diff --git a/src/app/service/messaging.service.ts b/src/app/service/messaging.service.ts index cd00656..08486f4 100644 --- a/src/app/service/messaging.service.ts +++ b/src/app/service/messaging.service.ts @@ -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!");