1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Add prop-types to package.json, redirect from create-password screen when isInitialized

This commit is contained in:
Alexander Tseung 2017-12-06 18:13:34 -05:00
parent 5d1187c37b
commit d905b86ba7
2 changed files with 22 additions and 2 deletions

View File

@ -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)),
})

View File

@ -101,8 +101,8 @@
"fast-json-patch": "^2.0.4",
"fast-levenshtein": "^2.0.6",
"fuse.js": "^3.2.0",
"gulp-autoprefixer": "^4.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-autoprefixer": "^4.0.0",
"gulp-eslint": "^4.0.0",
"gulp-sass": "^3.1.0",
"hat": "0.0.3",
@ -135,6 +135,7 @@
"post-message-stream": "^3.0.0",
"promise-filter": "^1.1.0",
"promise-to-callback": "^1.0.0",
"prop-types": "^15.6.0",
"pump": "^1.0.2",
"pumpify": "^1.3.4",
"qrcode-npm": "0.0.3",