Skip to content

Commit

Permalink
Redirect "/#/link?...&v=1" and "/#/wallets" to home page, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
petejkim committed Feb 25, 2020
1 parent dbfafcf commit 73fa545
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion web/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { createHashHistory } from "history"
import React from "react"
import { Route, Router } from "react-router-dom"
import { Route, Router, Redirect } from "react-router-dom"
import { SERVER_URL, WEB_URL } from "../config"
import { isLocalStorageBlocked, postMessageToParent } from "../lib/util"
import { MainRepository } from "../repositories/MainRepository"
Expand Down Expand Up @@ -44,6 +44,9 @@ export class App extends React.PureComponent {
<Route exact path={routes.linked} component={LinkedRoute} />
</AppContext.Provider>

<Route exact path={routes.wallets}>
<Redirect to={routes.root} />
</Route>
<Route exact path={routes.reset} component={ResetRoute} />
</Router>
)
Expand Down
12 changes: 9 additions & 3 deletions web/src/components/Link/LinkRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@ export class LinkRoute extends React.PureComponent<RouteComponentProps> {
public componentDidMount() {
const { mainRepo } = this.context
const { history } = this.props
const query = querystring.parse(
this.props.location.search.slice(1)
)

if (!mainRepo) {
return
}

if (!!query.v) {
history.replace(routes.wallets)
return
}

if (mainRepo.sessionLinked) {
history.replace(routes.linked)
return
}

const userSuppliedSessionId = querystring.parse(
this.props.location.search.slice(1)
).id
const userSuppliedSessionId = query.id
if (userSuppliedSessionId && userSuppliedSessionId !== mainRepo.sessionId) {
postMessageToParent(LocalStorageBlockedMessage())
}
Expand Down
3 changes: 2 additions & 1 deletion web/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const routes = {
link: "/link",
linked: "/linked",
reset: "/reset",
bridge: "/bridge"
bridge: "/bridge",
wallets: "/wallets"
}

0 comments on commit 73fa545

Please sign in to comment.