Implement toggleaccountmenu action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-06-24 15:07:11 +02:00
parent 146514d386
commit ace4a6b364
7 changed files with 35 additions and 16 deletions

View File

@@ -1,6 +1,9 @@
import { Component, OnInit,Input } from '@angular/core';
import { OAuthService} from 'angular-oauth2-oidc'
import { IUser } from '../../models/user';
import {Store} from '@ngrx/store';
import * as appReducers from '../../reducers/app-common.reducer';
import * as appActions from '../../actions/app-common.actions';
@Component({
selector: 'fm-user-menu',
@@ -10,9 +13,9 @@ import { IUser } from '../../models/user';
export class UserMenuComponent implements OnInit {
@Input() user:IUser;
public showMenu:boolean = false
@Input() showMenu:boolean;
constructor(private oauthService:OAuthService) { }
constructor(private oauthService:OAuthService, private store: Store<appReducers.State>) { }
ngOnInit(): void {
}
@@ -26,15 +29,9 @@ export class UserMenuComponent implements OnInit {
this.oauthService.logOut();
}
hide(event:MouseEvent) {
this.showMenu = false;
}
show(event:MouseEvent) {
this.showMenu=true;
}
toggle(event:MouseEvent) {
this.showMenu=!this.showMenu;
}
event.stopPropagation();
this.store.dispatch(new appActions.ToggleAccountMenu());
}
}