Extra RPC endpoint split on hash (#1708)

This commit is contained in:
Jaco Greeff 2019-10-08 16:29:27 +02:00 committed by GitHub
parent 338ba5a0dd
commit 16924fff15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,15 +28,15 @@ const rootElement = document.getElementById(rootId);
// - http://localhost:3000/?rpc=wss://substrate-rpc.parity.io/#/explorer
// - http://localhost:3000/#/explorer?rpc=wss://substrate-rpc.parity.io
const urlOptions = queryString.parse(location.href.split('?')[1]);
const wsEndpoint = urlOptions.rpc || process.env.WS_URL || settings.apiUrl;
const _wsEndpoint = urlOptions.rpc || process.env.WS_URL || settings.apiUrl;
if (Array.isArray(wsEndpoint)) {
if (Array.isArray(_wsEndpoint)) {
throw new Error('Invalid WS endpoint specified');
}
if (!rootElement) {
throw new Error(`Unable to find element with id '${rootId}'`);
}
// on some combo of browsers/os, this https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9944#/explorer
// turns into ws://127.0.0.1:9944#/explorer (split these)
const wsEndpoint = _wsEndpoint.split('#')[0];
console.log('WS endpoint=', wsEndpoint);
@ -56,6 +56,10 @@ const theme = {
theme: settings.uiTheme
};
if (!rootElement) {
throw new Error(`Unable to find element with id '${rootId}'`);
}
ReactDOM.render(
<Suspense fallback='...'>
<Queue>