22 lines
448 B
TypeScript
22 lines
448 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|||
|
|
import { fetchLastComplaint } from '@/app/actions/violationActions';
|
||
|
|
|
||
|
|
export interface useLastComplaint {
|
||
|
|
test: number,
|
||
|
|
}
|
||
|
|
|
||
|
|
export const useLastComplaints = () => {
|
||
|
|
return useQuery({
|
||
|
|
queryKey: ['lastComplaints'],
|
||
|
|
queryFn: () => {
|
||
|
|
return fetchLastComplaint()
|
||
|
|
},
|
||
|
|
select: (data: useLastComplaint | null) => {
|
||
|
|
if (!data) {
|
||
|
|
return null
|
||
|
|
}
|
||
|
|
return data;
|
||
|
|
},
|
||
|
|
retry: false
|
||
|
|
});
|
||
|
|
};
|