Fix signer token updates (#3302)

* Manual bump of package.json (recovery)

* Debug

* Simplify status connections
This commit is contained in:
Jaco Greeff 2016-11-09 18:26:10 +01:00 committed by Arkadiy Paronyan
parent 29aecc2cff
commit 877cfe9b53
3 changed files with 6 additions and 12 deletions

View File

@ -85,11 +85,6 @@ export default class Status {
setTimeout(this._pollStatus, timeout);
};
const wasConnected = this._store.getState().nodeStatus.isConnected;
if (isConnected !== wasConnected) {
this._fetchEnode();
}
this._store.dispatch(statusCollection({ isConnected, isConnecting, needsToken, secureToken }));
if (!isConnected) {
@ -111,8 +106,7 @@ export default class Status {
this._api.parity.netPort(),
this._api.parity.nodeName(),
this._api.parity.rpcSettings(),
this._api.eth.syncing(),
this._pollTraceMode()
this._api.eth.syncing()
])
.then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => {
const isTest = netChain === 'morden' || netChain === 'testnet';
@ -134,12 +128,12 @@ export default class Status {
isTest,
traceMode
}));
nextTimeout();
})
.catch((error) => {
console.error('_pollStatus', error);
nextTimeout();
});
nextTimeout();
}
_pollLogs = () => {

View File

@ -23,7 +23,7 @@ export default class SecureApi extends Api {
super(new Api.Transport.Ws(url, sysuiToken));
this._isConnecting = true;
this._connectState = 0;
this._connectState = sysuiToken === 'initial' ? 1 : 0;
this._needsToken = false;
this._dappsPort = 8080;
this._signerPort = 8180;
@ -110,7 +110,7 @@ export default class SecureApi extends Api {
console.log('SecureApi:connectSuccess', this._transport.token);
}
updateToken (token, connectState) {
updateToken (token, connectState = 0) {
this._connectState = connectState;
this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, ''));
this._followConnection();

View File

@ -128,7 +128,7 @@ class Connection extends Component {
const { api } = this.context;
const { token } = this.state;
api.updateToken(token);
api.updateToken(token, 0);
this.setState({ token: '', validToken: false });
}
}