feat: initial public release (MAESTRO)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { fetchPieces, fetchPiece } from '../api';
|
||||
import { STALE_TIME } from '../lib/constants.js';
|
||||
|
||||
export function usePieceList() {
|
||||
return useQuery({ queryKey: ['pieces'], queryFn: fetchPieces, staleTime: STALE_TIME.SEMI_STATIC });
|
||||
}
|
||||
|
||||
export function usePiece(name: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: ['piece', name],
|
||||
queryFn: () => fetchPiece(name!),
|
||||
enabled: !!name,
|
||||
staleTime: STALE_TIME.SEMI_STATIC,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user