aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/middleware/logger.ts
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/framework/src/middleware/logger.ts')
-rw-r--r--sdnr/wt/odlux/framework/src/middleware/logger.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/sdnr/wt/odlux/framework/src/middleware/logger.ts b/sdnr/wt/odlux/framework/src/middleware/logger.ts
new file mode 100644
index 000000000..e47484fbf
--- /dev/null
+++ b/sdnr/wt/odlux/framework/src/middleware/logger.ts
@@ -0,0 +1,17 @@
+import { Dispatch } from '../flux/store';
+import { MiddlewareApi } from '../store/applicationStore';
+
+
+function createLoggerMiddleware() {
+ return function logger({ getState }: MiddlewareApi) {
+ return (next: Dispatch): Dispatch => action => {
+ console.log('will dispatch', action);
+ const returnValue = next(action);
+ console.log('state after dispatch', getState());
+ return returnValue;
+ };
+ }
+}
+
+export const logger = createLoggerMiddleware();
+export default logger; \ No newline at end of file