OSDN Git Service

fixed the initialize account error.
authorZhiting Lin <zlin035@uottawa.ca>
Mon, 15 Jul 2019 05:03:11 +0000 (13:03 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Mon, 15 Jul 2019 05:03:11 +0000 (13:03 +0800)
src/features/app/components/Container.jsx

index c2e61ec..db99032 100644 (file)
@@ -36,15 +36,12 @@ class Container extends React.Component {
   }
 
   componentDidMount() {
-    this.props.fetchAccountItem().then(resp => {
+    this.props.fetchKeyItem().then(resp => {
       if (resp.data.length == 0) {
         this.props.updateAccountInit(false)
         this.redirectRoot(this.props)
       }else{
-        const aliasArray = resp.data.map(account => account.alias)
-        if(!aliasArray.includes(this.props.currentAccount)){
-          this.props.setDefaultAccount()
-        }
+        this.props.updateAccountInit(true)
       }
     })
     if(this.props.lng === 'zh'){
@@ -123,7 +120,7 @@ export default connect(
     showRoot: () => dispatch(actions.app.showRoot),
     showInitialization: () => dispatch(actions.app.showInitialization()),
     updateAccountInit: (param) => dispatch(actions.app.updateAccountInit(param)),
-    fetchAccountItem: () => dispatch(actions.account.fetchItems()),
+    fetchKeyItem: () => dispatch(actions.key.fetchItems()),
     setDefaultAccount:() => dispatch(actions.account.setDefaultAccount())
   })
 )( withI18n() (Container) )