Refactored logout
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -18,6 +18,7 @@ export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
||||
export const OPENMODAL = '[AppCommon] OpenModal';
|
||||
export const CLOSEMODAL = '[AppCommon] CloseModal';
|
||||
export const LOGIN = '[AppCommon] Login';
|
||||
export const LOGOUT = '[AppCommon] Logout';
|
||||
export const ESCAPE = '[AppCommon] Escape';
|
||||
|
||||
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
|
||||
@@ -116,6 +117,12 @@ export class Login implements Action {
|
||||
constructor(public url: string) { }
|
||||
}
|
||||
|
||||
export class Logout implements Action {
|
||||
readonly type = LOGOUT;
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
|
||||
export class Escape implements Action {
|
||||
readonly type = ESCAPE;
|
||||
|
||||
@@ -247,6 +254,7 @@ export type Actions = OpenModal
|
||||
| InitRootSuccess
|
||||
| CloseModal
|
||||
| Login
|
||||
| Logout
|
||||
| ItemChangedEvent
|
||||
| ItemAddedEvent
|
||||
| ItemDeletedEvent
|
||||
@@ -273,3 +281,4 @@ export type Actions = OpenModal
|
||||
| InitUserPackagesSuccess
|
||||
| ToggleAccountMenu;
|
||||
|
||||
|
||||
|
@@ -26,7 +26,7 @@ export class UserMenuComponent implements OnInit {
|
||||
|
||||
logout(event:MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.oauthService.logOut();
|
||||
this.store.dispatch(new appActions.Logout());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,10 +25,18 @@ export class AppCommonEffects {
|
||||
withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)),
|
||||
mergeMap(([action, initialized]) => {
|
||||
var a = (action as appCommonActions.Login);
|
||||
this.oauthService$.initCodeFlow(a.url);
|
||||
this.oauthService$.initCodeFlow(a.url,{"prompt":"login"});
|
||||
return [];
|
||||
}));
|
||||
|
||||
@Effect({ dispatch: false })
|
||||
logout$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(appCommonActions.LOGOUT),
|
||||
mergeMap((action) => {
|
||||
this.oauthService$.logOut(true);
|
||||
return [];
|
||||
}));
|
||||
|
||||
@Effect()
|
||||
loadItemTypes$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(appCommonActions.LOADITEMTYPES),
|
||||
|
@@ -106,6 +106,9 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
|
||||
return tassign(state,{userPackages:packages});
|
||||
}
|
||||
case appCommonActions.LOGOUT:{
|
||||
return tassign(state,{user:null});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
|
Reference in New Issue
Block a user