Files
remark42/frontend/app/utils/parseQuery.ts
T
Yuriy KarpovandUmputun 4e0a4e52bd add the ability to configure the 'simple_view' parameter from the client,
the parameter is not required, but if set, it will overwrite the one that came from the backend
issues-916
2021-05-06 11:08:15 -05:00

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;
}