fix(external_api): detect and skip params for hash routers
This commit is contained in:
parent
32083fc44d
commit
03f8d8b51a
|
@ -19,9 +19,18 @@ export default function parseURLParams(
|
||||||
source: string = 'hash'): Object {
|
source: string = 'hash'): Object {
|
||||||
const paramStr = source === 'search' ? url.search : url.hash;
|
const paramStr = source === 'search' ? url.search : url.hash;
|
||||||
const params = {};
|
const params = {};
|
||||||
|
const paramParts = (paramStr && paramStr.substr(1).split('&')) || [];
|
||||||
|
|
||||||
// eslint-disable-next-line newline-per-chained-call
|
// Detect and ignore hash params for hash routers.
|
||||||
paramStr && paramStr.substr(1).split('&').forEach(part => {
|
if (source === 'hash' && paramParts.length === 1) {
|
||||||
|
const firstParam = paramParts[0];
|
||||||
|
|
||||||
|
if (firstParam.startsWith('/') && firstParam.split('&').length === 1) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
paramParts.forEach(part => {
|
||||||
const param = part.split('=');
|
const param = part.split('=');
|
||||||
const key = param[0];
|
const key = param[0];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue