Use query-string for search parsing
This commit is contained in:
parent
73dcde65aa
commit
e67b05e632
35
js/package-lock.json
generated
35
js/package-lock.json
generated
@ -3147,6 +3147,11 @@
|
||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
|
||||
},
|
||||
"decode-uri-component": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
|
||||
"integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
|
||||
},
|
||||
"deep-eql": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz",
|
||||
@ -5942,6 +5947,17 @@
|
||||
"loose-envify": "1.3.1",
|
||||
"query-string": "4.3.4",
|
||||
"warning": "3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"query-string": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
|
||||
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
|
||||
"requires": {
|
||||
"object-assign": "4.1.1",
|
||||
"strict-uri-encode": "1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"hmac-drbg": {
|
||||
@ -8261,6 +8277,18 @@
|
||||
"prepend-http": "1.0.4",
|
||||
"query-string": "4.3.4",
|
||||
"sort-keys": "1.1.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"query-string": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
|
||||
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"object-assign": "4.1.1",
|
||||
"strict-uri-encode": "1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"npm-run-path": {
|
||||
@ -9907,10 +9935,11 @@
|
||||
"integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A=="
|
||||
},
|
||||
"query-string": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-4.3.4.tgz",
|
||||
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-5.0.1.tgz",
|
||||
"integrity": "sha512-aM+MkQClojlNiKkO09tiN2Fv8jM/L7GWIjG2liWeKljlOdOPNWr+bW3KQ+w5V/uKprpezC7fAsAMsJtJ+2rLKA==",
|
||||
"requires": {
|
||||
"decode-uri-component": "0.2.0",
|
||||
"object-assign": "4.1.1",
|
||||
"strict-uri-encode": "1.1.0"
|
||||
}
|
||||
|
@ -158,6 +158,7 @@
|
||||
"lodash.uniq": "4.5.0",
|
||||
"material-ui": "0.16.5",
|
||||
"prop-types": "15.5.10",
|
||||
"query-string": "5.0.1",
|
||||
"react": "15.6.1",
|
||||
"react-dom": "15.6.1",
|
||||
"react-intl": "2.1.5",
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user