feat(contact-us): Add delete functionality to contact us table

- Add delete button with trash icon to contact us table rows
- Implement confirmation modal for delete action
- Create useDeleteContactUs mutation hook with success callback
- Add deleteContactUs method to contact-us service
- Update API endpoints to support BASE() function for dynamic ID routing
- Add state management for modal open/close and current contact selection
- Integrate toast notifications for delete success feedback
- Add tooltip component to delete button for better UX
- Update query key to use BASE() endpoint for consistency
This commit is contained in:
AmirReza Jamali
2025-11-23 13:33:07 +03:30
parent a8d95d5f92
commit 2389ad1bbf
6 changed files with 107 additions and 9 deletions
+12 -1
View File
@@ -5,7 +5,7 @@ import { TContactApiResponseSchema } from "../types/TContacts";
export const contactUsService = {
getAllContactUs: async (): Promise<TContactApiResponseSchema> => {
try {
return (await api.get(API_ENDPOINTS.CONTACT_US.READ_ALL)).data;
return (await api.get(API_ENDPOINTS.CONTACT_US.BASE())).data;
} catch (error) {
console.error(
"ERROR caught in contact-us service => getAllContactUs",
@@ -14,4 +14,15 @@ export const contactUsService = {
throw error;
}
},
deleteContactUs: async (id: string) => {
try {
return (await api.delete(API_ENDPOINTS.CONTACT_US.BASE(id))).data;
} catch (error) {
console.error(
"ERROR caught in contact-us service => deleteContactUs",
error,
);
throw error;
}
},
};