})
this.props.showRoot()
})
+ this.props.fetchAccountItem().then(resp => {
+ const promise = new Promise((resolve, reject) => {
+ if (resp.data.length == 0) {
+ this.props.switchAccount('')
+ resolve()
+ }else{
+ const aliasArray = resp.data.map(account => account.alias)
+ if(!aliasArray.includes(this.props.currentAccount) ){
+ this.props.setDefaultAccount().then(()=>{
+ resolve()
+ })
+ }else{
+ resolve()
+ }
+ }
+ })
+
+ return promise.then(()=>{
+ return this.props.fetchKeyItem().then(resp => {
+ if (resp.data.length == 0) {
+ this.props.updateAccountInit(false)
+ }else{
+ this.props.updateAccountInit(true)
+ }
+ return this.props.fetchInfo().then(() => {
+ this.redirectRoot(this.props)
+ })
+ })
+ })
+ })
+
setInterval(() => this.props.fetchInfo(), CORE_POLLING_TIME)
}
if(arg === 'init'){
this.props.updateMiningState(isMining)
})
}
+
if(this.props.lng === 'zh'){
moment.locale('zh-cn')
}else{
}
}
- componentWillMount() {
- this.props.fetchAccountItem().then(resp => {
- const promise = new Promise((resolve, reject) => {
- if (resp.data.length == 0) {
- this.props.switchAccount('')
- resolve()
- }else{
- const aliasArray = resp.data.map(account => account.alias)
- if(!aliasArray.includes(this.props.currentAccount) ){
- this.props.setDefaultAccount().then(()=>{
- resolve()
- })
- }else{
- resolve()
- }
- }
- })
-
- return promise.then(()=>{
- return this.props.fetchKeyItem().then(resp => {
- if (resp.data.length == 0) {
- this.props.updateAccountInit(false)
- }else{
- this.props.updateAccountInit(true)
- }
- return this.props.fetchInfo().then(() => {
- this.redirectRoot(this.props)
- })
- })
- })
- })
-
- setInterval(() => this.props.fetchInfo(), CORE_POLLING_TIME)
- }
-
componentWillReceiveProps(nextProps) {
if (nextProps.accountInit != this.props.accountInit ||
nextProps.configured != this.props.configured ||