aboutsummaryrefslogtreecommitdiffstats
path: root/mascara/src
diff options
context:
space:
mode:
authorAlexander Tseung <alextsg@gmail.com>2017-12-07 07:13:34 +0800
committerAlexander Tseung <alextsg@gmail.com>2017-12-15 06:11:23 +0800
commitd905b86ba775aad888d1dfd22257958fd9415909 (patch)
tree2b1de13e0a5abfdc2fcd80e5e2411d9bc474a671 /mascara/src
parent5d1187c37bfee988d7384f189f228882ce847005 (diff)
downloadtangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar.gz
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar.bz2
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar.lz
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar.xz
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.tar.zst
tangerine-wallet-browser-d905b86ba775aad888d1dfd22257958fd9415909.zip
Add prop-types to package.json, redirect from create-password screen when isInitialized
Diffstat (limited to 'mascara/src')
-rw-r--r--mascara/src/app/first-time/create-password-screen.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/mascara/src/app/first-time/create-password-screen.js b/mascara/src/app/first-time/create-password-screen.js
index 102d8a7c3..17b9174b8 100644
--- a/mascara/src/app/first-time/create-password-screen.js
+++ b/mascara/src/app/first-time/create-password-screen.js
@@ -11,6 +11,8 @@ class CreatePasswordScreen extends Component {
isLoading: PropTypes.bool.isRequired,
createAccount: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
+ isInitialized: PropTypes.bool,
+ isUnlocked: PropTypes.bool,
}
state = {
@@ -18,6 +20,13 @@ class CreatePasswordScreen extends Component {
confirmPassword: '',
}
+ componentWillMount () {
+ const { isInitialized, isUnlocked, history } = this.props
+ if (isInitialized || isUnlocked) {
+ history.push(DEFAULT_ROUTE)
+ }
+ }
+
isValid () {
const { password, confirmPassword } = this.state
@@ -107,8 +116,18 @@ class CreatePasswordScreen extends Component {
}
}
+const mapStateToProps = state => {
+ const { metamask: { isInitialized, isUnlocked }, appState: { isLoading } } = state
+
+ return {
+ isLoading,
+ isInitialized,
+ isUnlocked,
+ }
+}
+
export default connect(
- ({ appState: { isLoading } }) => ({ isLoading }),
+ mapStateToProps,
dispatch => ({
createAccount: password => dispatch(createNewVaultAndKeychain(password)),
})