feat(mapManagerToParams): create mapper to transform filter values to query param values

This commit is contained in:
Ilia Mashkov
2026-01-13 20:08:46 +03:00
parent 52ecb9e304
commit 7146328982

View File

@@ -0,0 +1,12 @@
import type { FontshareParams } from '$entities/Font';
import type { FilterManager } from '../filterManager/filterManager.svelte';
export function mapManagerToParams(manager: FilterManager): Partial<FontshareParams> {
return {
q: manager.debouncedQueryValue,
// Map groups to specific API keys
categories: manager.getGroup('categories')?.instance.selectedProperties.map(p => p.value)
?? [],
tags: manager.getGroup('tags')?.instance.selectedProperties.map(p => p.value) ?? [],
};
}