/* eslint-disable @typescript-eslint/no-explicit-any */
import useUrlState, { Options } from '@ahooksjs/use-url-state'
import { INIT_COLLECTION } from '../store/slowLogDetailSearch'
import { INIT_RANGE } from '../store/globalSearch'
const useMyUrlState = <T>(params?: T, options?: Options) =>
useUrlState(
{
instance: INIT_RANGE.instanceId,
timeRange: INIT_RANGE.timeRange,
collection: INIT_COLLECTION,
...params,
},
{
parseOptions: { parseNumbers: true, arrayFormat: 'comma' },
stringifyOptions: { skipNull: true, arrayFormat: 'comma' },
navigateMode: 'replace',
...options,
}
)
export default useMyUrlState