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:
@@ -3,9 +3,11 @@ import { API_ENDPOINTS } from "../endpoints";
|
||||
import { TContactApiResponseSchema } from "../types/TContacts";
|
||||
|
||||
export const contactUsService = {
|
||||
getAllContactUs: async (): Promise<TContactApiResponseSchema> => {
|
||||
getAllContactUs: async (
|
||||
params?: Record<string, unknown>,
|
||||
): Promise<TContactApiResponseSchema> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.CONTACT_US.BASE())).data;
|
||||
return (await api.get(API_ENDPOINTS.CONTACT_US.BASE(), { params })).data;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"ERROR caught in contact-us service => getAllContactUs",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import api from "../axios";
|
||||
import { API_ENDPOINTS } from "../endpoints";
|
||||
import { ApiResponse } from "../types";
|
||||
import { TFeedbackResponse } from "../types/Feedback";
|
||||
import { TFeedback } from "../types/Feedback";
|
||||
|
||||
export const feedbackService = {
|
||||
getFeedbacks: async (
|
||||
params: Record<string, any>,
|
||||
): Promise<TFeedbackResponse> => {
|
||||
params: Record<string, unknown>,
|
||||
): Promise<ApiResponse<TFeedback[]>> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.FEEDBACK.READ_ALL, { params })).data;
|
||||
} catch (error) {
|
||||
@@ -16,7 +16,7 @@ export const feedbackService = {
|
||||
},
|
||||
getSingleFeedback: async (
|
||||
id: string,
|
||||
): Promise<ApiResponse<TFeedbackResponse>> => {
|
||||
): Promise<ApiResponse<TFeedback>> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.FEEDBACK.DETAILS(id))).data;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user