feat(contact-us & feedback tables): implement pagination and loading states
- Added pagination functionality to ContactUsTable and FeedbackTable components, enhancing user navigation through large datasets. - Integrated loading states to provide visual feedback during data fetching. - Updated data fetching hooks to accept parameters for improved query handling. - Refactored table row rendering to include pagination metadata for accurate row numbering. - Enhanced overall user experience by conditionally rendering pagination controls based on data availability.
This commit is contained in:
@@ -4,12 +4,15 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useMemo } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
export const useReadAllContactUs = () => {
|
||||
const queryKey = useMemo(() => [API_ENDPOINTS.CONTACT_US.BASE()], []);
|
||||
export const useReadAllContactUs = (params?: Record<string, unknown>) => {
|
||||
const queryKey = useMemo(
|
||||
() => [API_ENDPOINTS.CONTACT_US.BASE(), params],
|
||||
[params],
|
||||
);
|
||||
|
||||
return useQuery({
|
||||
queryKey,
|
||||
queryFn: () => contactUsService.getAllContactUs(),
|
||||
queryFn: () => contactUsService.getAllContactUs(params),
|
||||
});
|
||||
};
|
||||
export const useDeleteContactUs = (successCallback?: () => void) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ export const useGetFeedSingleFeedback = (id: string) => {
|
||||
queryFn: () => feedbackService.getSingleFeedback(id),
|
||||
});
|
||||
};
|
||||
export const useGetFeedback = (params: Record<string, any>) => {
|
||||
export const useGetFeedback = (params: Record<string, unknown>) => {
|
||||
const queryKey = useMemo(
|
||||
() => [API_ENDPOINTS.FEEDBACK.READ_ALL, params],
|
||||
[params],
|
||||
|
||||
Reference in New Issue
Block a user