feat: zap (#107)

This commit is contained in:
Cody Tseng 2025-03-01 23:52:05 +08:00 committed by GitHub
parent 407a6fb802
commit 249593d547
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
72 changed files with 2582 additions and 818 deletions

View file

@ -6,5 +6,4 @@ export * from './useFetchProfile'
export * from './useFetchRelayInfo'
export * from './useFetchRelayInfos'
export * from './useFetchRelayList'
export * from './useSearchParams'
export * from './useSearchProfiles'

View file

@ -1,24 +0,0 @@
export function useSearchParams() {
const searchParams = new URLSearchParams(window.location.search)
return {
searchParams,
get: (key: string) => searchParams.get(key),
set: (key: string, value: string) => {
searchParams.set(key, value)
window.history.replaceState(
null,
'',
`${window.location.pathname}?${searchParams.toString()}`
)
},
delete: (key: string) => {
searchParams.delete(key)
window.history.replaceState(
null,
'',
`${window.location.pathname}?${searchParams.toString()}`
)
}
}
}