You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
import React, { PureComponent } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { Switch, Route } from 'react-router-dom'
|
|
import RevealSeedPhrase from './reveal-seed-phrase'
|
|
import ConfirmSeedPhrase from './confirm-seed-phrase'
|
|
import {
|
|
INITIALIZE_SEED_PHRASE_ROUTE,
|
|
INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE,
|
|
DEFAULT_ROUTE,
|
|
} from '../../../../routes'
|
|
|
|
export default class SeedPhrase extends PureComponent {
|
|
static propTypes = {
|
|
address: PropTypes.string,
|
|
history: PropTypes.object,
|
|
seedPhrase: PropTypes.string,
|
|
}
|
|
|
|
componentDidMount () {
|
|
const { seedPhrase, history } = this.props
|
|
|
|
if (!seedPhrase) {
|
|
history.push(DEFAULT_ROUTE)
|
|
}
|
|
}
|
|
|
|
render () {
|
|
const { address, seedPhrase } = this.props
|
|
|
|
return (
|
|
<div className="first-time-flow__wrapper">
|
|
<Switch>
|
|
<Route
|
|
exact
|
|
path={INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE}
|
|
render={props => (
|
|
<ConfirmSeedPhrase
|
|
{ ...props }
|
|
address={address}
|
|
seedPhrase={seedPhrase}
|
|
/>
|
|
)}
|
|
/>
|
|
<Route
|
|
exact
|
|
path={INITIALIZE_SEED_PHRASE_ROUTE}
|
|
render={props => (
|
|
<RevealSeedPhrase
|
|
{ ...props }
|
|
address={address}
|
|
seedPhrase={seedPhrase}
|
|
/>
|
|
)}
|
|
/>
|
|
</Switch>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|