|
@@ -19,9 +19,18 @@ export default function parseURLParams(
|
19
|
19
|
source: string = 'hash'): Object {
|
20
|
20
|
const paramStr = source === 'search' ? url.search : url.hash;
|
21
|
21
|
const params = {};
|
|
22
|
+ const paramParts = (paramStr && paramStr.substr(1).split('&')) || [];
|
22
|
23
|
|
23
|
|
- // eslint-disable-next-line newline-per-chained-call
|
24
|
|
- paramStr && paramStr.substr(1).split('&').forEach(part => {
|
|
24
|
+ // Detect and ignore hash params for hash routers.
|
|
25
|
+ if (source === 'hash' && paramParts.length === 1) {
|
|
26
|
+ const firstParam = paramParts[0];
|
|
27
|
+
|
|
28
|
+ if (firstParam.startsWith('/') && firstParam.split('&').length === 1) {
|
|
29
|
+ return params;
|
|
30
|
+ }
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ paramParts.forEach(part => {
|
25
|
34
|
const param = part.split('=');
|
26
|
35
|
const key = param[0];
|
27
|
36
|
|