mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 09:13:14 +03:00
fix(web): broken links to places search (#7208)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import SearchHistoryBox from './search-history-box.svelte';
|
||||
import SearchFilterBox from './search-filter-box.svelte';
|
||||
import type { MetadataSearchDto, SmartSearchDto } from '@immich/sdk';
|
||||
import { getMetadataSearchQuery } from '$lib/utils/metadata-search';
|
||||
export let value = '';
|
||||
export let grayTheme: boolean;
|
||||
|
||||
@@ -24,15 +25,13 @@
|
||||
$: showClearIcon = value.length > 0;
|
||||
|
||||
const onSearch = (payload: SmartSearchDto | MetadataSearchDto) => {
|
||||
const parameters = new URLSearchParams({
|
||||
query: JSON.stringify(payload),
|
||||
});
|
||||
const params = getMetadataSearchQuery(payload);
|
||||
|
||||
showHistory = false;
|
||||
showFilter = false;
|
||||
$isSearchEnabled = false;
|
||||
$searchQuery = payload;
|
||||
goto(`${AppRoute.SEARCH}?${parameters}`, { invalidateAll: true });
|
||||
goto(`${AppRoute.SEARCH}?${params}`, { invalidateAll: true });
|
||||
};
|
||||
|
||||
const clearSearchTerm = (searchTerm: string) => {
|
||||
|
||||
9
web/src/lib/utils/metadata-search.ts
Normal file
9
web/src/lib/utils/metadata-search.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { QueryParameter } from '$lib/constants';
|
||||
import type { MetadataSearchDto } from '@immich/sdk';
|
||||
|
||||
export function getMetadataSearchQuery(metadata: MetadataSearchDto) {
|
||||
const searchParams = new URLSearchParams({
|
||||
[QueryParameter.QUERY]: JSON.stringify(metadata),
|
||||
});
|
||||
return searchParams.toString();
|
||||
}
|
||||
Reference in New Issue
Block a user