mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
23 lines
526 B
TypeScript
23 lines
526 B
TypeScript
import pick from 'lodash/pick';
|
|
import * as qs from 'query-string';
|
|
|
|
import {URL_PARAM} from 'sentry/constants/pageFilters';
|
|
|
|
const DEFAULT_STATUS = 'unresolved';
|
|
|
|
/**
|
|
* Get query for API given the current location.search string
|
|
*/
|
|
export function getQuery(search: string) {
|
|
const query = qs.parse(search);
|
|
|
|
const status = typeof query.status !== 'undefined' ? query.status : DEFAULT_STATUS;
|
|
|
|
const queryParams = {
|
|
status,
|
|
...pick(query, ['cursor', ...Object.values(URL_PARAM)]),
|
|
};
|
|
|
|
return queryParams;
|
|
}
|