add complain registration, add view complaint inforation, add status change for marches when user click on mat
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getFileViolations } from '@/app/actions/violationActions';
|
||||
|
||||
export interface ViolationFileDetail {
|
||||
id: number;
|
||||
url: string;
|
||||
page_url: string;
|
||||
page_title: string;
|
||||
host: string;
|
||||
status: string;
|
||||
created_date: string;
|
||||
file_id: string;
|
||||
}
|
||||
|
||||
interface ViolationFile {
|
||||
violations: ViolationFileDetail[],
|
||||
total_elements: number,
|
||||
total_pages: number,
|
||||
current_page: number,
|
||||
page_size: number,
|
||||
has_next: boolean,
|
||||
has_previous: boolean
|
||||
}
|
||||
|
||||
export const useFileViolations = (id: string, page: number) => {
|
||||
return useQuery({
|
||||
queryKey: ['fileViolations', id, page],
|
||||
queryFn: () => {
|
||||
return getFileViolations(id, page)
|
||||
},
|
||||
select: (data: ViolationFile | null) => {
|
||||
if (!data) {
|
||||
return null
|
||||
}
|
||||
return data;
|
||||
},
|
||||
retry: false
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user