add complaints\claims blocks
This commit is contained in:
@@ -1,15 +1,36 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { fetchLastCase } from '@/app/actions/violationActions';
|
||||
import { fetchLastCase, ComplaintsCaseQueryParams } from '@/app/actions/violationActions';
|
||||
|
||||
interface Case {
|
||||
amount: number;
|
||||
content: null | string;
|
||||
createdAt: string;
|
||||
description: string;
|
||||
id: number;
|
||||
lawyer: null | string;
|
||||
name: string;
|
||||
pageNumber: number;
|
||||
pageSize: number;
|
||||
priority: "HIGH" | "MEDIUM" | "LOW";
|
||||
totalElements: number;
|
||||
totalPages: number;
|
||||
type: "ACTIVE" | "INACTIVE" | string;
|
||||
updatedAt: string;
|
||||
violationId: number;
|
||||
}
|
||||
export interface useLastCase {
|
||||
test: number,
|
||||
content: Case[],
|
||||
page: 1,
|
||||
size: 5,
|
||||
totalElements: 10,
|
||||
totalPages: 2,
|
||||
}
|
||||
|
||||
export const useLastCases = () => {
|
||||
export const useLastCases = (params: ComplaintsCaseQueryParams) => {
|
||||
return useQuery({
|
||||
queryKey: ['lastCases'],
|
||||
queryFn: () => {
|
||||
return fetchLastCase()
|
||||
return fetchLastCase(params)
|
||||
},
|
||||
select: (data: useLastCase | null) => {
|
||||
if (!data) {
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { fetchLastComplaint } from '@/app/actions/violationActions';
|
||||
import { fetchLastComplaint, ComplaintsCaseQueryParams } from '@/app/actions/violationActions';
|
||||
|
||||
interface Complaint {
|
||||
complaint_text: string,
|
||||
created_at: string,
|
||||
email: string,
|
||||
id: number,
|
||||
not_moderated: boolean,
|
||||
status: "CREATED" | string,
|
||||
updated_at: string,
|
||||
violation_id: number,
|
||||
}
|
||||
export interface useLastComplaint {
|
||||
test: number,
|
||||
content: Complaint[],
|
||||
page: 1,
|
||||
size: 5,
|
||||
totalElements: 10,
|
||||
totalPages: 2,
|
||||
}
|
||||
|
||||
export const useLastComplaints = () => {
|
||||
export const useLastComplaints = (params: ComplaintsCaseQueryParams) => {
|
||||
return useQuery({
|
||||
queryKey: ['lastComplaints'],
|
||||
queryFn: () => {
|
||||
return fetchLastComplaint()
|
||||
return fetchLastComplaint(params)
|
||||
},
|
||||
select: (data: useLastComplaint | null) => {
|
||||
if (!data) {
|
||||
|
||||
Reference in New Issue
Block a user