88bc939956
- 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.
31 lines
855 B
TypeScript
31 lines
855 B
TypeScript
import api from "../axios";
|
|
import { API_ENDPOINTS } from "../endpoints";
|
|
import { ApiResponse } from "../types";
|
|
import { TFeedback } from "../types/Feedback";
|
|
|
|
export const feedbackService = {
|
|
getFeedbacks: async (
|
|
params: Record<string, unknown>,
|
|
): Promise<ApiResponse<TFeedback[]>> => {
|
|
try {
|
|
return (await api.get(API_ENDPOINTS.FEEDBACK.READ_ALL, { params })).data;
|
|
} catch (error) {
|
|
console.error("ERROR Caught in feedback service => getFeedbacks", error);
|
|
throw error;
|
|
}
|
|
},
|
|
getSingleFeedback: async (
|
|
id: string,
|
|
): Promise<ApiResponse<TFeedback>> => {
|
|
try {
|
|
return (await api.get(API_ENDPOINTS.FEEDBACK.DETAILS(id))).data;
|
|
} catch (error) {
|
|
console.error(
|
|
"ERROR Caught in feedback service => getSingleFeedback",
|
|
error,
|
|
);
|
|
throw error;
|
|
}
|
|
},
|
|
};
|