Compare commits
No commits in common. "7a1ba9521216c9f6c43e81e707fe2257dd63f04d" and "1cab239155506631008bc54f053e23c7ab57d516" have entirely different histories.
7a1ba95212
...
1cab239155
@ -181,20 +181,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
newQueryState = tassign(mapReducers.initialQueryState);
|
newQueryState = tassign(mapReducers.initialQueryState);
|
||||||
if (queryState != "") {
|
if (queryState != "") {
|
||||||
newQueryState = this.serializeService.deserialize(queryState);
|
newQueryState = this.serializeService.deserialize(queryState);
|
||||||
queryState = this.serializeService.serialize(newQueryState);
|
|
||||||
}
|
}
|
||||||
queryStateChanged = this.lastQueryState != queryState;
|
queryStateChanged = this.lastQueryState != queryState;
|
||||||
this.lastQueryState = queryState;
|
this.lastQueryState = queryState;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapStateChanged && queryStateChanged) {
|
if (mapStateChanged && queryStateChanged) {
|
||||||
console.debug("Both states");
|
//console.log("Both states");
|
||||||
this.store.dispatch(new mapActions.SetState(newMapState, newQueryState));
|
this.store.dispatch(new mapActions.SetState(newMapState, newQueryState));
|
||||||
} else if (mapStateChanged) {
|
} else if (mapStateChanged) {
|
||||||
console.debug("Map state");
|
//console.log("Map state");
|
||||||
this.store.dispatch(new mapActions.SetMapState(newMapState));
|
this.store.dispatch(new mapActions.SetMapState(newMapState));
|
||||||
} else if (queryStateChanged) {
|
} else if (queryStateChanged) {
|
||||||
console.debug("Query state");
|
//console.log("Query state");
|
||||||
this.store.dispatch(new mapActions.SetQueryState(newQueryState));
|
this.store.dispatch(new mapActions.SetQueryState(newQueryState));
|
||||||
}
|
}
|
||||||
this.stateSetCount += 1;
|
this.stateSetCount += 1;
|
||||||
|
@ -13,6 +13,7 @@ export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
|||||||
export const OPENMODAL = '[AppCommon] OpenModal';
|
export const OPENMODAL = '[AppCommon] OpenModal';
|
||||||
export const CLOSEMODAL = '[AppCommon] CloseModal';
|
export const CLOSEMODAL = '[AppCommon] CloseModal';
|
||||||
export const LOGIN = '[AppCommon] Login';
|
export const LOGIN = '[AppCommon] Login';
|
||||||
|
export const INITIALIZED = '[AppCommon] Initialized';
|
||||||
export const ESCAPE = '[AppCommon] Escape';
|
export const ESCAPE = '[AppCommon] Escape';
|
||||||
|
|
||||||
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
|
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
|
||||||
@ -103,6 +104,12 @@ export class Login implements Action {
|
|||||||
constructor(public url: string) { }
|
constructor(public url: string) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Initialized implements Action {
|
||||||
|
readonly type = INITIALIZED;
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
}
|
||||||
|
|
||||||
export class Escape implements Action {
|
export class Escape implements Action {
|
||||||
readonly type = ESCAPE;
|
readonly type = ESCAPE;
|
||||||
|
|
||||||
@ -228,6 +235,7 @@ export type Actions = OpenModal
|
|||||||
| InitRootSuccess
|
| InitRootSuccess
|
||||||
| CloseModal
|
| CloseModal
|
||||||
| Login
|
| Login
|
||||||
|
| Initialized
|
||||||
| ItemChangedEvent
|
| ItemChangedEvent
|
||||||
| ItemAddedEvent
|
| ItemAddedEvent
|
||||||
| ItemDeletedEvent
|
| ItemDeletedEvent
|
||||||
|
@ -40,15 +40,10 @@ export class AppCommonEffects {
|
|||||||
@Effect()
|
@Effect()
|
||||||
initUser$: Observable<Action> = this.actions$.pipe(
|
initUser$: Observable<Action> = this.actions$.pipe(
|
||||||
ofType(appCommonActions.INITUSER),
|
ofType(appCommonActions.INITUSER),
|
||||||
withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)),
|
switchMap(() => {
|
||||||
switchMap(([action, initialized]) => {
|
|
||||||
if(!initialized) {
|
|
||||||
return this.userService$.getCurrentUser().pipe(
|
return this.userService$.getCurrentUser().pipe(
|
||||||
map((user: IUser) => new appCommonActions.InitUserSuccess(user)),
|
map((user: IUser) => new appCommonActions.InitUserSuccess(user)),
|
||||||
catchError(error => of(new appCommonActions.Fail(error))))
|
catchError(error => of(new appCommonActions.Fail(error))))
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
|||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case appCommonActions.INITUSERSUCCESS: {
|
case appCommonActions.INITUSERSUCCESS: {
|
||||||
let a = action as appCommonActions.InitUserSuccess;
|
let a = action as appCommonActions.InitUserSuccess;
|
||||||
return tassign(state, { user: a.user,initialized: true });
|
return tassign(state, { user: a.user });
|
||||||
}
|
}
|
||||||
case appCommonActions.INITROOTSUCCESS: {
|
case appCommonActions.INITROOTSUCCESS: {
|
||||||
let a = action as appCommonActions.InitRootSuccess;
|
let a = action as appCommonActions.InitRootSuccess;
|
||||||
@ -44,7 +44,10 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
|||||||
}
|
}
|
||||||
case appCommonActions.CLOSEMODAL: {
|
case appCommonActions.CLOSEMODAL: {
|
||||||
return tassign(state, { openedModalName: null });
|
return tassign(state, { openedModalName: null });
|
||||||
}
|
}
|
||||||
|
case appCommonActions.INITIALIZED: {
|
||||||
|
return tassign(state, { initialized: true });
|
||||||
|
}
|
||||||
case appCommonActions.LOADITEMTYPESSUCCESS: {
|
case appCommonActions.LOADITEMTYPESSUCCESS: {
|
||||||
let a = action as appCommonActions.LoadItemTypesSuccess;
|
let a = action as appCommonActions.LoadItemTypesSuccess;
|
||||||
return tassign(state, { itemTypes: a.itemTypes });
|
return tassign(state, { itemTypes: a.itemTypes });
|
||||||
|
@ -18,6 +18,8 @@ import * as appCommonActions from '../actions/app-common.actions';
|
|||||||
})
|
})
|
||||||
export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
|
export class AuthGuard implements CanActivate, CanLoad, CanActivateChild {
|
||||||
|
|
||||||
|
private loginDispatched = false;
|
||||||
|
private initialized = false;
|
||||||
constructor(private oauthService: OAuthService, private router: Router, private store: Store<appCommonReducer.State> ) { }
|
constructor(private oauthService: OAuthService, private router: Router, private store: Store<appCommonReducer.State> ) { }
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user