Use .entries only if we're in a modern browser (#934)
This commit is contained in:
parent
48acd86258
commit
b8cc0faa8b
|
@ -1,11 +1,11 @@
|
|||
export const entries = (params) => {
|
||||
if (typeof Object.fromEntries === 'function') {
|
||||
return Object.fromEntries(params)
|
||||
return Object.fromEntries(params.entries())
|
||||
}
|
||||
|
||||
const obj = {}
|
||||
|
||||
params.forEach(([key, val]) => {
|
||||
params.forEach((val, key) => {
|
||||
obj[key] = val
|
||||
})
|
||||
|
||||
|
@ -23,6 +23,6 @@ export const getPathInfo = (path) => {
|
|||
return {
|
||||
path: withoutTrailingSlash,
|
||||
query: search,
|
||||
queryParams: entries(searchParams.entries())
|
||||
queryParams: entries(searchParams)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue