aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework/src/middleware')
-rw-r--r--sdnr/wt/odlux/framework/src/middleware/logger.ts7
-rw-r--r--sdnr/wt/odlux/framework/src/middleware/navigation.ts2
2 files changed, 5 insertions, 4 deletions
diff --git a/sdnr/wt/odlux/framework/src/middleware/logger.ts b/sdnr/wt/odlux/framework/src/middleware/logger.ts
index 47725e696..fb0874f3e 100644
--- a/sdnr/wt/odlux/framework/src/middleware/logger.ts
+++ b/sdnr/wt/odlux/framework/src/middleware/logger.ts
@@ -18,16 +18,17 @@
import { Dispatch } from '../flux/store';
import { MiddlewareApi } from '../store/applicationStore';
+const LogLevel = +(localStorage.getItem('log.odlux.framework.middleware.logger') || 0);
function createLoggerMiddleware() {
return function logger({ getState }: MiddlewareApi) {
return (next: Dispatch): Dispatch => action => {
- console.log('will dispatch', action);
+ if (LogLevel > 2) console.log('will dispatch', action);
const returnValue = next(action);
- console.log('state after dispatch', getState());
+ if (LogLevel > 2) console.log('state after dispatch', getState());
return returnValue;
};
- }
+ };
}
export const logger = createLoggerMiddleware();
diff --git a/sdnr/wt/odlux/framework/src/middleware/navigation.ts b/sdnr/wt/odlux/framework/src/middleware/navigation.ts
index 5f3eed55d..44035fec3 100644
--- a/sdnr/wt/odlux/framework/src/middleware/navigation.ts
+++ b/sdnr/wt/odlux/framework/src/middleware/navigation.ts
@@ -55,7 +55,7 @@ const routerMiddlewareCreator = (history: History) => () => (next: Dispatch): Di
// ensure user is logged in and token is valid
if (action.pathname.startsWith("/oauth") && (action.search.startsWith("?token="))){
const ind = action.search.lastIndexOf("token=");
- const tokenStr = ind > -1 ? action.search.substr(ind+6) : null;
+ const tokenStr = ind > -1 ? action.search.substring(ind+6) : null;
const token = tokenStr && jwt.decode(tokenStr);
if (tokenStr && token) {
// @ts-ignore