aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/app.js
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-06-02 23:45:36 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-06-02 23:45:36 -0700
commite31aa39fc28645fe27646b1e6c6f7e876280ed69 (patch)
tree8536a77b278d8182205e8ba757e1e1f00ac67d76 /web/src/js/app.js
parent65fde7f5547f179c80d5858f1ab69583b63fd099 (diff)
parent5321f15defcef641bf5b7ba39e5c9057d562c5f8 (diff)
downloadmitmproxy-e31aa39fc28645fe27646b1e6c6f7e876280ed69.tar.gz
mitmproxy-e31aa39fc28645fe27646b1e6c6f7e876280ed69.tar.bz2
mitmproxy-e31aa39fc28645fe27646b1e6c6f7e876280ed69.zip
Merge branch 'redux-ducks'
Diffstat (limited to 'web/src/js/app.js')
-rw-r--r--web/src/js/app.js33
1 files changed, 22 insertions, 11 deletions
diff --git a/web/src/js/app.js b/web/src/js/app.js
index e21fa499..fc99f1d2 100644
--- a/web/src/js/app.js
+++ b/web/src/js/app.js
@@ -1,17 +1,28 @@
import React from "react"
-import { render } from 'react-dom'
-import $ from "jquery"
+import {render} from 'react-dom'
+import {applyMiddleware, createStore} from 'redux'
+import {Provider} from 'react-redux'
+import createLogger from 'redux-logger';
+
import Connection from "./connection"
-import {app} from "./components/proxyapp.js"
-import { EventLogActions } from "./actions.js"
+import {App} from "./components/proxyapp.js"
+import rootReducer from './ducks/index';
+import {addLogEntry} from "./ducks/eventLog";
-$(function () {
- window.ws = new Connection("/updates");
+// logger must be last
+const logger = createLogger();
+const store = createStore(rootReducer, applyMiddleware(logger));
- window.onerror = function (msg) {
- EventLogActions.add_event(msg);
- };
+window.onerror = function (msg) {
+ store.dispatch(addLogEntry(msg));
+};
- render(app, document.getElementById("mitmproxy"));
-});
+document.addEventListener('DOMContentLoaded', () => {
+ window.ws = new Connection("/updates", store.dispatch);
+ render(
+ <Provider store={store}>{App}</Provider>,
+ document.getElementById("mitmproxy")
+ );
+
+});