mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 16:23:25 +01:00
22 lines
503 B
TypeScript
22 lines
503 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { invokeCmd } from '../lib/tauri';
|
|
|
|
export function useFilterResponse({
|
|
responseId,
|
|
filter,
|
|
}: {
|
|
responseId: string | null;
|
|
filter: string;
|
|
}) {
|
|
return useQuery<string | null, string>({
|
|
queryKey: ['filter_response', responseId, filter],
|
|
queryFn: async () => {
|
|
if (filter === '') {
|
|
return null;
|
|
}
|
|
|
|
return (await invokeCmd('cmd_filter_response', { responseId, filter })) as string | null;
|
|
},
|
|
});
|
|
}
|