diff options
author | Jason <jason.daurus@gmail.com> | 2016-05-24 23:08:21 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-05-24 23:08:21 +0800 |
commit | 61453aa8479498c83f439d83fff60e9a9b17ab01 (patch) | |
tree | 62626381438854095c8f8003881bfbc50437477e /web/src/js/components/common.js | |
parent | c160a47e51aa86283c6be9315c35bf3a9f6b68e4 (diff) | |
download | mitmproxy-61453aa8479498c83f439d83fff60e9a9b17ab01.tar.gz mitmproxy-61453aa8479498c83f439d83fff60e9a9b17ab01.tar.bz2 mitmproxy-61453aa8479498c83f439d83fff60e9a9b17ab01.zip |
[web] eliminate Router mixin
Diffstat (limited to 'web/src/js/components/common.js')
-rw-r--r-- | web/src/js/components/common.js | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/web/src/js/components/common.js b/web/src/js/components/common.js index 21ca454f..b257b82c 100644 --- a/web/src/js/components/common.js +++ b/web/src/js/components/common.js @@ -2,32 +2,6 @@ import React from "react" import ReactDOM from "react-dom" import _ from "lodash" -export var Router = { - contextTypes: { - location: React.PropTypes.object, - router: React.PropTypes.object.isRequired - }, - updateLocation: function (pathname, queryUpdate) { - if (pathname === undefined) { - pathname = this.context.location.pathname; - } - var query = this.context.location.query; - if (queryUpdate !== undefined) { - for (var i in queryUpdate) { - if (queryUpdate.hasOwnProperty(i)) { - query[i] = queryUpdate[i] || undefined; //falsey values shall be removed. - } - } - } - this.context.router.replace({pathname, query}); - }, - getQuery: function () { - // For whatever reason, react-router always returns the same object, which makes comparing - // the current props with nextProps impossible. As a workaround, we just clone the query object. - return _.clone(this.context.location.query); - } -}; - export var Splitter = React.createClass({ getDefaultProps: function () { return { @@ -143,4 +117,4 @@ export const ToggleComponent = (props) => ToggleComponent.propTypes = { name: React.PropTypes.string.isRequired, onToggleChanged: React.PropTypes.func.isRequired -}
\ No newline at end of file +} |