From 61453aa8479498c83f439d83fff60e9a9b17ab01 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 24 May 2016 23:08:21 +0800 Subject: [web] eliminate Router mixin --- web/src/js/components/common.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'web/src/js/components/common.js') 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 +} -- cgit v1.2.3