summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework/src/handlers')
-rw-r--r--sdnr/wt/odlux/framework/src/handlers/applicationStateHandler.ts19
-rw-r--r--sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts6
2 files changed, 19 insertions, 6 deletions
diff --git a/sdnr/wt/odlux/framework/src/handlers/applicationStateHandler.ts b/sdnr/wt/odlux/framework/src/handlers/applicationStateHandler.ts
index 61e1334e7..16c6ed5d3 100644
--- a/sdnr/wt/odlux/framework/src/handlers/applicationStateHandler.ts
+++ b/sdnr/wt/odlux/framework/src/handlers/applicationStateHandler.ts
@@ -31,6 +31,9 @@ import { ExternalLoginProvider } from '../models/externalLoginProvider';
import { ApplicationConfig } from '../models/applicationConfig';
import { IConnectAppStoreState } from '../../../apps/connectApp/src/handlers/connectAppRootHandler';
import { IFaultAppStoreState } from '../../../apps/faultApp/src/handlers/faultAppRootHandler';
+import { GeneralSettings } from '../models/settings';
+import { SetGeneralSettingsAction } from '../actions/settingsAction';
+import { startWebsocketSession, suspendWebsocketSession } from '../services/notificationService';
declare module '../store/applicationStore' {
@@ -47,11 +50,12 @@ export interface IApplicationState {
isMenuClosedByUser: boolean;
errors: ErrorInfo[];
snackBars: SnackbarItem[];
- isWebsocketAvailable: boolean | undefined;
+ isWebsocketAvailable: boolean | null;
externalLoginProviders: ExternalLoginProvider[] | null;
authentication: "basic"|"oauth", // basic
enablePolicy: boolean, // false
- transportpceUrl : string
+ transportpceUrl : string,
+ settings: GeneralSettings
}
const applicationStateInit: IApplicationState = {
@@ -60,11 +64,12 @@ const applicationStateInit: IApplicationState = {
snackBars: [],
isMenuOpen: true,
isMenuClosedByUser: false,
- isWebsocketAvailable: undefined,
+ isWebsocketAvailable: null,
externalLoginProviders: null,
authentication: "basic",
enablePolicy: false,
- transportpceUrl: ""
+ transportpceUrl: "",
+ settings:{ general: { areNotificationsEnabled: null }}
};
export const configureApplication = (config: ApplicationConfig) => {
@@ -141,6 +146,12 @@ export const applicationStateHandler: IActionHandler<IApplicationState> = (state
...state,
externalLoginProviders: action.externalLoginProvders,
}
+ }else if(action instanceof SetGeneralSettingsAction){
+
+ state = {
+ ...state,
+ settings:{general:{areNotificationsEnabled: action.areNoticationsActive}}
+ }
}
return state;
};
diff --git a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
index 5217bd414..1bcb43528 100644
--- a/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
+++ b/sdnr/wt/odlux/framework/src/handlers/authenticationHandler.ts
@@ -22,6 +22,8 @@ import { AuthPolicy, User } from '../models/authentication';
import { onLogin, onLogout } from '../services/applicationApi';
import { startWebsocketSession, endWebsocketSession } from '../services/notificationService';
+import { startUserSession, endUserSession } from '../services/userSessionService';
+import { getSettings } from '../services/settingsService';
export interface IAuthenticationState {
user?: User;
@@ -38,11 +40,11 @@ export const authenticationStateHandler: IActionHandler<IAuthenticationState> =
if (user) {
localStorage.setItem("userToken", user.toString());
- startWebsocketSession();
+ startUserSession(user);
onLogin();
} else {
localStorage.removeItem("userToken");
- endWebsocketSession();
+ endUserSession();
onLogout();
}