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:
parent
f89209c555
commit
fe2650c4fd
12
package-lock.json
generated
12
package-lock.json
generated
@ -2692,14 +2692,14 @@
|
||||
}
|
||||
},
|
||||
"@farmmaps/common": {
|
||||
"version": "0.0.1-prerelease.289",
|
||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.289.tgz",
|
||||
"integrity": "sha512-TlgNLEpagOtgC24X/olIrK+9ijLbh1gqLKEw4FgoyRV/T4iYBuZewfGvrPmoeKxY6lNdx2nIAhwOmOoRMcH5qQ=="
|
||||
"version": "0.0.1-prerelease.300",
|
||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.300.tgz",
|
||||
"integrity": "sha512-76f+K6ZWQki9HL7cYmiQt+/Bkprfb1+y6C0vSPN3EpRSG7DSRLTdjk/cJoy6VVThS38YADUQom8Bvw4arNXhZw=="
|
||||
},
|
||||
"@farmmaps/common-map": {
|
||||
"version": "0.0.1-prerelease.289",
|
||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.289.tgz",
|
||||
"integrity": "sha512-HOECDkP7xwBQqbGx2WmaKgtyalwgcw/7K4CW5eTMT0kSJXc+2JJbCDcQlso5a1DwzaF24bzpR3L1sEGJiPof4w=="
|
||||
"version": "0.0.1-prerelease.300",
|
||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.300.tgz",
|
||||
"integrity": "sha512-PMgAgRj9wvUEaSCcMyNcyAovViu05wwh8b6taSSWLs7G6eS2RAToIlBrYIXsPRbcC1cyV58W10e5UrbNHeECvw=="
|
||||
},
|
||||
"@istanbuljs/schema": {
|
||||
"version": "0.1.2",
|
||||
|
@ -19,8 +19,8 @@
|
||||
"@angular/platform-browser": "~9.1.0",
|
||||
"@angular/platform-browser-dynamic": "~9.1.0",
|
||||
"@angular/router": "~9.1.0",
|
||||
"@farmmaps/common": ">=0.0.1-prerelease.289 <0.0.1",
|
||||
"@farmmaps/common-map": ">=0.0.1-prerelease.289 <0.0.1",
|
||||
"@farmmaps/common": ">=0.0.1-prerelease.300 <0.0.1",
|
||||
"@farmmaps/common-map": ">=0.0.1-prerelease.300 <0.0.1",
|
||||
"@microsoft/signalr": "^3.1.3",
|
||||
"@ng-bootstrap/ng-bootstrap": "^6.0",
|
||||
"@ngrx/effects": "^9.0",
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user