Use query-string for search parsing

This commit is contained in:
Jaco Greeff
2017-11-21 12:31:34 +01:00
parent 73dcde65aa
commit e67b05e632
3 changed files with 36 additions and 19 deletions

View File

@@ -15,29 +15,16 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import Api from '@parity/api';
import qs from 'query-string';
import Web3 from 'web3';
import web3extensions from './web3.extensions';
function initProvider () {
const path = window.location.pathname.split('/');
const qs = ((query) => {
if (!query) {
return {};
}
const query = qs.parse(window.location.search);
return query.split('&').reduce((result, combined) => {
const [name, value] = combined.split('=', 2);
result[name] = !name
? ''
: decodeURIComponent(value.replace(/\+/g, ' '));
return result;
}, {});
})(window.location.search.substr(1));
let appId = path[1] || qs.appId;
let appId = path[1] || query.appId;
console.log('appId', appId, path, qs);