Forward Angular Routes from V3 (#320)

This commit is contained in:
skubakdj 2017-10-29 04:24:28 -04:00 committed by Daniel Ternyak
parent 5b81c42d27
commit 9d58329450
1 changed files with 42 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { Router, Route } from 'react-router-dom';
import { withRouter, Switch, Redirect, Router, Route } from 'react-router-dom';
// Components
import Contracts from 'containers/Tabs/Contracts';
import ENS from 'containers/Tabs/ENS';
@ -33,9 +33,50 @@ export default class Root extends Component<Props, {}> {
<Route path="/contracts" component={Contracts} />
<Route path="/ens" component={ENS} />
<Route path="/pushTx" component={BroadcastTx} />
<LegacyRoutes />
</div>
</Router>
</Provider>
);
}
}
const LegacyRoutes = withRouter(props => {
const { history } = props;
const { pathname, hash } = props.location;
if (pathname === '/') {
switch (hash) {
case '#send-transaction':
case '#offline-transaction':
history.push('/send-transaction');
break;
case '#generate-wallet':
history.push('/');
break;
case '#swap':
history.push('/swap');
break;
case '#contracts':
history.push('/contracts');
break;
case '#ens':
history.push('/ens');
break;
case '#view-wallet-info':
history.push('/view-wallet');
break;
case '#check-tx-status':
history.push('/check-tx-status');
break;
}
}
return (
<Switch>
<Redirect from="/signmsg.html" to="/sign-and-verify-message" />
<Redirect from="/helpers.html" to="/helpers" />
</Switch>
);
});