From b7fe9aa398a82e1031c439504e9cdb9e098fb67d Mon Sep 17 00:00:00 2001 From: danny Date: Thu, 26 Oct 2017 01:36:40 -0400 Subject: [PATCH] adapt hash & *.html routes --- common/Root.tsx | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/common/Root.tsx b/common/Root.tsx index e3dfbb23ccd..90a0212da7b 100644 --- a/common/Root.tsx +++ b/common/Root.tsx @@ -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 { + + ); } } + +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 ( + + + + + ); +});