the parameter is not required, but if set, it will overwrite the one that came from the backend issues-916
10 lines
322 B
TypeScript
10 lines
322 B
TypeScript
/** converts window.location.search into object */
|
|
|
|
export default function parseQuery<T extends {}>(search: string = window.location.search): T {
|
|
const params: { [key: string]: string } = {};
|
|
new URLSearchParams(search).forEach((value: string, key: string) => {
|
|
params[key] = value;
|
|
});
|
|
return params as T;
|
|
}
|