• R/O
  • HTTP
  • SSH
  • HTTPS

bytom-electron: 提交

Bytom Desktop Electron App


Commit MetaInfo

修订版5350882b73210cda2352f4cfe46c9075290a2c4f (tree)
时间2019-07-18 17:22:14
作者Zhiting Lin <zlin035@uott...>
CommiterZhiting Lin

Log Message

netinfo fetch after network init.

更改概述

差异

--- a/src/features/app/components/Container.jsx
+++ b/src/features/app/components/Container.jsx
@@ -64,6 +64,37 @@ class Container extends React.Component {
6464 })
6565 this.props.showRoot()
6666 })
67+ this.props.fetchAccountItem().then(resp => {
68+ const promise = new Promise((resolve, reject) => {
69+ if (resp.data.length == 0) {
70+ this.props.switchAccount('')
71+ resolve()
72+ }else{
73+ const aliasArray = resp.data.map(account => account.alias)
74+ if(!aliasArray.includes(this.props.currentAccount) ){
75+ this.props.setDefaultAccount().then(()=>{
76+ resolve()
77+ })
78+ }else{
79+ resolve()
80+ }
81+ }
82+ })
83+
84+ return promise.then(()=>{
85+ return this.props.fetchKeyItem().then(resp => {
86+ if (resp.data.length == 0) {
87+ this.props.updateAccountInit(false)
88+ }else{
89+ this.props.updateAccountInit(true)
90+ }
91+ return this.props.fetchInfo().then(() => {
92+ this.redirectRoot(this.props)
93+ })
94+ })
95+ })
96+ })
97+
6798 setInterval(() => this.props.fetchInfo(), CORE_POLLING_TIME)
6899 }
69100 if(arg === 'init'){
@@ -75,6 +106,7 @@ class Container extends React.Component {
75106 this.props.updateMiningState(isMining)
76107 })
77108 }
109+
78110 if(this.props.lng === 'zh'){
79111 moment.locale('zh-cn')
80112 }else{
@@ -82,41 +114,6 @@ class Container extends React.Component {
82114 }
83115 }
84116
85- componentWillMount() {
86- this.props.fetchAccountItem().then(resp => {
87- const promise = new Promise((resolve, reject) => {
88- if (resp.data.length == 0) {
89- this.props.switchAccount('')
90- resolve()
91- }else{
92- const aliasArray = resp.data.map(account => account.alias)
93- if(!aliasArray.includes(this.props.currentAccount) ){
94- this.props.setDefaultAccount().then(()=>{
95- resolve()
96- })
97- }else{
98- resolve()
99- }
100- }
101- })
102-
103- return promise.then(()=>{
104- return this.props.fetchKeyItem().then(resp => {
105- if (resp.data.length == 0) {
106- this.props.updateAccountInit(false)
107- }else{
108- this.props.updateAccountInit(true)
109- }
110- return this.props.fetchInfo().then(() => {
111- this.redirectRoot(this.props)
112- })
113- })
114- })
115- })
116-
117- setInterval(() => this.props.fetchInfo(), CORE_POLLING_TIME)
118- }
119-
120117 componentWillReceiveProps(nextProps) {
121118 if (nextProps.accountInit != this.props.accountInit ||
122119 nextProps.configured != this.props.configured ||
Show on old repository browser