Skip to content

Commit

Permalink
Forward Angular Routes from V3 (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
skubakdj authored and dternyak committed Oct 29, 2017
1 parent 5b81c42 commit 9d58329
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion common/Root.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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>
);
});

0 comments on commit 9d58329

Please sign in to comment.