|
@@ -4,18 +4,20 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
type AppsQuery = {
|
|
type AppsQuery = {
|
|
tagIDs?: string[]
|
|
tagIDs?: string[]
|
|
keywords?: string
|
|
keywords?: string
|
|
|
|
+ isCreatedByMe?: boolean
|
|
}
|
|
}
|
|
|
|
|
|
// Parse the query parameters from the URL search string.
|
|
// Parse the query parameters from the URL search string.
|
|
function parseParams(params: ReadonlyURLSearchParams): AppsQuery {
|
|
function parseParams(params: ReadonlyURLSearchParams): AppsQuery {
|
|
const tagIDs = params.get('tagIDs')?.split(';')
|
|
const tagIDs = params.get('tagIDs')?.split(';')
|
|
const keywords = params.get('keywords') || undefined
|
|
const keywords = params.get('keywords') || undefined
|
|
- return { tagIDs, keywords }
|
|
|
|
|
|
+ const isCreatedByMe = params.get('isCreatedByMe') === 'true'
|
|
|
|
+ return { tagIDs, keywords, isCreatedByMe }
|
|
}
|
|
}
|
|
|
|
|
|
// Update the URL search string with the given query parameters.
|
|
// Update the URL search string with the given query parameters.
|
|
function updateSearchParams(query: AppsQuery, current: URLSearchParams) {
|
|
function updateSearchParams(query: AppsQuery, current: URLSearchParams) {
|
|
- const { tagIDs, keywords } = query || {}
|
|
|
|
|
|
+ const { tagIDs, keywords, isCreatedByMe } = query || {}
|
|
|
|
|
|
if (tagIDs && tagIDs.length > 0)
|
|
if (tagIDs && tagIDs.length > 0)
|
|
current.set('tagIDs', tagIDs.join(';'))
|
|
current.set('tagIDs', tagIDs.join(';'))
|
|
@@ -26,6 +28,11 @@ function updateSearchParams(query: AppsQuery, current: URLSearchParams) {
|
|
current.set('keywords', keywords)
|
|
current.set('keywords', keywords)
|
|
else
|
|
else
|
|
current.delete('keywords')
|
|
current.delete('keywords')
|
|
|
|
+
|
|
|
|
+ if (isCreatedByMe)
|
|
|
|
+ current.set('isCreatedByMe', 'true')
|
|
|
|
+ else
|
|
|
|
+ current.delete('isCreatedByMe')
|
|
}
|
|
}
|
|
|
|
|
|
function useAppsQueryState() {
|
|
function useAppsQueryState() {
|