feat(contact-us): Add filtering functionality to contact us list table
- Enable Contact Us navigation menu item in sidebar with visible flag set to true - Create TContacts type schema with Zod validation for API responses - Add type safety to contactUsService.getAllContactUs() with return type annotation - Implement contact list table rendering with proper data mapping - Display contact information columns: full name, email, status, phone, created date - Add date formatting using unixToDate utility for created_at timestamps - Update useContactUsListPresenter to return properly structured contacts data - Refactor table columns array to include all contact detail fields - Follows established pattern from recent filtering feature implementations
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import api from "../axios";
|
||||
import { API_ENDPOINTS } from "../endpoints";
|
||||
import { TContactApiResponseSchema } from "../types/TContacts";
|
||||
|
||||
export const contactUsService = {
|
||||
getAllContactUs: async () => {
|
||||
getAllContactUs: async (): Promise<TContactApiResponseSchema> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.CONTACT_US.READ_ALL)).data;
|
||||
} catch (error) {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { z } from "zod";
|
||||
import { createApiResponseSchema } from "./Factory";
|
||||
const contactsListSchema = z.object({
|
||||
admin_notes: z.string(),
|
||||
created_at: z.number(),
|
||||
email: z.string(),
|
||||
full_name: z.string(),
|
||||
id: z.string(),
|
||||
message: z.string(),
|
||||
phone: z.string(),
|
||||
resolved_at: z.number(),
|
||||
resolved_by: z.string(),
|
||||
status: z.string(),
|
||||
updated_at: z.number(),
|
||||
});
|
||||
|
||||
export const contactsListResponseSchema = z.object({
|
||||
contacts: z.array(contactsListSchema),
|
||||
});
|
||||
export const contactsApiResponse = createApiResponseSchema(
|
||||
contactsListResponseSchema,
|
||||
);
|
||||
|
||||
export type TContactApiResponseSchema = z.infer<typeof contactsApiResponse>;
|
||||
Reference in New Issue
Block a user