wwf
3 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/(commonLayout)/apps/hooks/useAppsQueryState.ts
@@ -4,20 +4,18 @@
type AppsQuery = {
  tagIDs?: string[]
  keywords?: string
  isCreatedByMe?: boolean
}
// Parse the query parameters from the URL search string.
function parseParams(params: ReadonlyURLSearchParams): AppsQuery {
  const tagIDs = params.get('tagIDs')?.split(';')
  const keywords = params.get('keywords') || undefined
  const isCreatedByMe = params.get('isCreatedByMe') === 'true'
  return { tagIDs, keywords, isCreatedByMe }
  return { tagIDs, keywords }
}
// Update the URL search string with the given query parameters.
function updateSearchParams(query: AppsQuery, current: URLSearchParams) {
  const { tagIDs, keywords, isCreatedByMe } = query || {}
  const { tagIDs, keywords } = query || {}
  if (tagIDs && tagIDs.length > 0)
    current.set('tagIDs', tagIDs.join(';'))
@@ -28,11 +26,6 @@
    current.set('keywords', keywords)
  else
    current.delete('keywords')
  if (isCreatedByMe)
    current.set('isCreatedByMe', 'true')
  else
    current.delete('isCreatedByMe')
}
function useAppsQueryState() {