From f306cfa8b6445dd04c5f7188d1a5022bcb747a62 Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Thu, 9 Jun 2016 17:46:14 +0800
Subject: [web] separate flowtable to multiple files

---
 web/src/js/app.jsx | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 web/src/js/app.jsx

(limited to 'web/src/js/app.jsx')

diff --git a/web/src/js/app.jsx b/web/src/js/app.jsx
new file mode 100644
index 00000000..8fa52a00
--- /dev/null
+++ b/web/src/js/app.jsx
@@ -0,0 +1,41 @@
+import React from "react"
+import { render } from 'react-dom'
+import { applyMiddleware, createStore } from 'redux'
+import { Provider } from 'react-redux'
+import createLogger from 'redux-logger'
+import thunkMiddleware from 'redux-thunk'
+import { Route, Router as ReactRouter, hashHistory, Redirect } from "react-router"
+
+import Connection from "./connection"
+import ProxyApp from "./components/ProxyApp"
+import MainView from './components/MainView'
+import rootReducer from './ducks/index'
+import { addLogEntry } from "./ducks/eventLog"
+
+// logger must be last
+const store = createStore(
+    rootReducer,
+    applyMiddleware(thunkMiddleware, createLogger())
+)
+
+window.addEventListener('error', msg => {
+    store.dispatch(addLogEntry(msg))
+})
+
+// @todo remove this
+document.addEventListener('DOMContentLoaded', () => {
+    window.ws = new Connection("/updates", store.dispatch)
+
+    render(
+        <Provider store={store}>
+            <ReactRouter history={hashHistory}>
+                <Redirect from="/" to="/flows" />
+                <Route path="/" component={ProxyApp}>
+                    <Route path="flows" component={MainView}/>
+                    <Route path="flows/:flowId/:detailTab" component={MainView}/>
+                </Route>
+            </ReactRouter>
+        </Provider>,
+        document.getElementById("mitmproxy")
+    )
+})
-- 
cgit v1.2.3

