Limit device registration to customers only
This commit is contained in:
parent
3fb5428e8c
commit
83fa5449b8
2 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!");
|
||||
|
|
Reference in a new issue