mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-02 16:45:15 -07:00
Initialize voicebox project with backend, frontend, and Tauri setup. Added configuration files, dependencies, and basic structure for components, hooks, and utilities. Included README and setup documentation for guidance.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { apiClient } from '@/lib/api/client';
|
||||
import type { HistoryQuery } from '@/lib/api/types';
|
||||
|
||||
export function useHistory(query?: HistoryQuery) {
|
||||
return useQuery({
|
||||
queryKey: ['history', query],
|
||||
queryFn: () => apiClient.listHistory(query),
|
||||
});
|
||||
}
|
||||
|
||||
export function useGenerationDetail(generationId: string) {
|
||||
return useQuery({
|
||||
queryKey: ['history', generationId],
|
||||
queryFn: () => apiClient.getGeneration(generationId),
|
||||
enabled: !!generationId,
|
||||
});
|
||||
}
|
||||
|
||||
export function useDeleteGeneration() {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: (generationId: string) => apiClient.deleteGeneration(generationId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['history'] });
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user