mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-21 23:46:18 -05:00
Using searching files is at /search.
This commit is contained in:
parent
f7f2627e79
commit
407d60c074
2 changed files with 5 additions and 3 deletions
|
|
@ -164,7 +164,8 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames) {
|
|||
{
|
||||
title: newSuggestions.fileGroups.toString(),
|
||||
type: 'files',
|
||||
location: getLocationStr({q: searchStr})
|
||||
// Add search query onto current location.
|
||||
location: getLocationStr({q: encodeURIComponent(searchStr)}, '/search')
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -179,6 +180,7 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames) {
|
|||
if (newSuggestions && zimSum > 0) {
|
||||
results.zimsSum = {
|
||||
name: 'Zims', results: [
|
||||
// Navigating to Zims is not relative. We don't want to keep filters or other extra params.
|
||||
{title: zimSum.toString(), type: 'zims', location: `/search/zim?q=${encodeURIComponent(searchStr)}`}
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ export const useQuery = () => {
|
|||
setQuery(newQuery);
|
||||
}
|
||||
|
||||
const getLocationStr = (newSearchParams) => {
|
||||
const getLocationStr = (newSearchParams, pathname) => {
|
||||
// Get the current location, but with new params appended.
|
||||
const newQuery = createSearchParams(getQuery(newSearchParams));
|
||||
return `${location.pathname}?${newQuery.toString()}`
|
||||
return `${pathname || location.pathname}?${newQuery.toString()}`
|
||||
}
|
||||
|
||||
return {searchParams, setSearchParams, setQuery, updateQuery, getLocationStr}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue