mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 10:42:12 +00:00
transform query to key value pair
This commit is contained in:
parent
ed1999d572
commit
706e2082c4
1 changed files with 5 additions and 1 deletions
|
|
@ -39,7 +39,11 @@ const Router = ({ className, homePath, viewsConfig, onPathNotMatch }) => {
|
|||
|
||||
const routeViewIndex = viewsConfig.findIndex((v) => v.includes(routeConfig));
|
||||
const match = routeConfig.regexp.exec(pathname);
|
||||
const queryParams = new URLSearchParams(query);
|
||||
const queryParams = Array.from(new URLSearchParams(query !== null ? query : '').entries())
|
||||
.reduce((result, [key, value]) => {
|
||||
result[key] = value;
|
||||
return result;
|
||||
}, {});
|
||||
const urlParams = routeConfig.keys.reduce((urlParams, key, index) => {
|
||||
if (typeof match[index + 1] === 'string') {
|
||||
urlParams[key.name] = match[index + 1];
|
||||
|
|
|
|||
Loading…
Reference in a new issue