Compare commits
No commits in common. "10bdd27608b744d9d8f213bde65011b1d287167a" and "31d01c75c53b25cf6a532253fa6c70eca52a10a2" have entirely different histories.
10bdd27608
...
31d01c75c5
@ -58,10 +58,6 @@ export const TOGGLEACCOUNTMENU = '[AppCommon] ToggleAccountMenu';
|
||||
|
||||
export const SETMENUVISIBLE = '[AppCommon] SetMenuVisible';
|
||||
|
||||
export const ONLINE = '[AppCommon] Online';
|
||||
|
||||
export const OFFLINE = '[AppCommon] Offline';
|
||||
|
||||
export class InitUser implements Action {
|
||||
readonly type = INITUSER;
|
||||
|
||||
@ -258,18 +254,6 @@ export class SetMenuVisible implements Action {
|
||||
|
||||
constructor(public visible:boolean) { }
|
||||
}
|
||||
|
||||
export class Online implements Action {
|
||||
readonly type = ONLINE;
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
|
||||
export class Offline implements Action {
|
||||
readonly type = OFFLINE;
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
|
||||
|
||||
export type Actions = OpenModal
|
||||
@ -303,8 +287,6 @@ export type Actions = OpenModal
|
||||
| SetMenuVisible
|
||||
| InitUserPackagesSuccess
|
||||
| ToggleAccountMenu
|
||||
| CloseAll
|
||||
| Online
|
||||
| Offline;
|
||||
| CloseAll;
|
||||
|
||||
|
||||
|
@ -98,23 +98,13 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
@HostListener('document:keyup', ['$event'])
|
||||
onKeyUp(event: KeyboardEvent) {
|
||||
keyUp(event: KeyboardEvent) {
|
||||
let x = event.keyCode;
|
||||
if (x === 27) {
|
||||
this.store.dispatch(new commonActions.Escape(true,false));
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('window:online', ['$event'])
|
||||
onOnline(event: Event) {
|
||||
this.store.dispatch(new commonActions.Online());
|
||||
}
|
||||
|
||||
@HostListener('window:offline', ['$event'])
|
||||
onOffline(event: Event) {
|
||||
this.store.dispatch(new commonActions.Offline());
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// Subscription clean-up
|
||||
if(this.routerSub$) this.routerSub$.unsubscribe();
|
||||
|
@ -162,25 +162,6 @@ export class AppCommonEffects {
|
||||
return null;
|
||||
}));
|
||||
|
||||
@Effect({ dispatch: false })
|
||||
online$: Observable<Action> = this.actions$.pipe(
|
||||
ofType(appCommonActions.ONLINE),
|
||||
map((action) => {
|
||||
console.debug("Online: Check token");
|
||||
if(!this.oauthService$.hasValidAccessToken()) {
|
||||
console.debug("No valid token, try to refresh");
|
||||
if(this.oauthService$.getRefreshToken() != null ) {
|
||||
console.debug("We have a refresh token");
|
||||
this.oauthService$.refreshToken().then(() => {
|
||||
this.store$.dispatch(new appCommonActions.InitUser());
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}));
|
||||
|
||||
|
||||
|
||||
constructor(private actions$: Actions, private store$: Store<appCommonReducers.State>, private oauthService$: OAuthService, private itemService$: ItemService, private folderService$:FolderService, private userService$: UserService, private router$: Router, private stateSerializerService$:StateSerializerService) {
|
||||
store$.dispatch(new appCommonActions.LoadItemTypes());
|
||||
}
|
||||
|
@ -18,8 +18,7 @@ export interface State {
|
||||
routeLoading:boolean,
|
||||
menuVisible: boolean,
|
||||
userPackages: IPackages,
|
||||
accountMenuVisible: boolean,
|
||||
isOnline: boolean
|
||||
accountMenuVisible: boolean
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
@ -32,8 +31,7 @@ export const initialState: State = {
|
||||
routeLoading: false,
|
||||
menuVisible: false,
|
||||
userPackages: {},
|
||||
accountMenuVisible: false,
|
||||
isOnline: window.navigator.onLine
|
||||
accountMenuVisible: false
|
||||
}
|
||||
|
||||
export function reducer(state = initialState, action: appCommonActions.Actions ): State {
|
||||
@ -114,12 +112,6 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
||||
case appCommonActions.CLOSEALL: {
|
||||
return tassign(state,{accountMenuVisible:false,menuVisible:false });
|
||||
}
|
||||
case appCommonActions.ONLINE:{
|
||||
return tassign(state,{isOnline:true});
|
||||
}
|
||||
case appCommonActions.OFFLINE:{
|
||||
return tassign(state,{isOnline:false});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
@ -136,7 +128,6 @@ export const getMenuVisible = (state: State) => state.menuVisible;
|
||||
export const getUser = (state: State) => state.user;
|
||||
export const getUserPackages = (state: State) => state.userPackages;
|
||||
export const getAccountMenuVisible = (state: State) => state.accountMenuVisible;
|
||||
export const getIsOnline = (state: State) => state.isOnline;
|
||||
|
||||
export const selectAppCommonState = createFeatureSelector<State>(MODULE_NAME);
|
||||
|
||||
@ -150,5 +141,4 @@ export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuV
|
||||
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
|
||||
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
|
||||
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
|
||||
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user