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.
47 lines
1.1 KiB
47 lines
1.1 KiB
4 years ago
|
import React, { PureComponent } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import { Redirect } from 'react-router-dom';
|
||
6 years ago
|
import {
|
||
|
DEFAULT_ROUTE,
|
||
4 years ago
|
LOCK_ROUTE,
|
||
4 years ago
|
INITIALIZE_END_OF_FLOW_ROUTE,
|
||
6 years ago
|
INITIALIZE_WELCOME_ROUTE,
|
||
|
INITIALIZE_UNLOCK_ROUTE,
|
||
4 years ago
|
} from '../../../helpers/constants/routes';
|
||
6 years ago
|
|
||
|
export default class FirstTimeFlowSwitch extends PureComponent {
|
||
|
static propTypes = {
|
||
|
completedOnboarding: PropTypes.bool,
|
||
|
isInitialized: PropTypes.bool,
|
||
4 years ago
|
isUnlocked: PropTypes.bool,
|
||
4 years ago
|
seedPhraseBackedUp: PropTypes.bool,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
4 years ago
|
render() {
|
||
4 years ago
|
const {
|
||
|
completedOnboarding,
|
||
|
isInitialized,
|
||
|
isUnlocked,
|
||
|
seedPhraseBackedUp,
|
||
4 years ago
|
} = this.props;
|
||
6 years ago
|
|
||
|
if (completedOnboarding) {
|
||
4 years ago
|
return <Redirect to={{ pathname: DEFAULT_ROUTE }} />;
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
if (seedPhraseBackedUp !== null) {
|
||
4 years ago
|
return <Redirect to={{ pathname: INITIALIZE_END_OF_FLOW_ROUTE }} />;
|
||
4 years ago
|
}
|
||
|
|
||
4 years ago
|
if (isUnlocked) {
|
||
4 years ago
|
return <Redirect to={{ pathname: LOCK_ROUTE }} />;
|
||
4 years ago
|
}
|
||
|
|
||
6 years ago
|
if (!isInitialized) {
|
||
4 years ago
|
return <Redirect to={{ pathname: INITIALIZE_WELCOME_ROUTE }} />;
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
return <Redirect to={{ pathname: INITIALIZE_UNLOCK_ROUTE }} />;
|
||
6 years ago
|
}
|
||
|
}
|