feat(mapManagerToParams): create mapper to transform filter values to query param values
This commit is contained in:
12
src/features/GetFonts/lib/mapper/mapManagerToParams.ts
Normal file
12
src/features/GetFonts/lib/mapper/mapManagerToParams.ts
Normal 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) ?? [],
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user