feat(form): add loading state and replace custom switch component
This commit introduces a loading state for form submissions and replaces the custom switch component with a third-party library for improved user experience and maintainability. - Adds `react-switch` as a dependency to replace the custom-built switch component, providing a more robust and feature-rich solution. - Implements a loading indicator on form submission buttons and in the confirmation modal by utilizing the `useIsMutating` hook from TanStack Query. This provides clear visual feedback to the user during asynchronous operations. - Creates a reusable `FormFooter` component to encapsulate the submit and cancel buttons, centralizing the form submission logic and loading state. - Refactors the company create/edit forms to use the new `FormFooter` and `react-switch` components. - Moves the `BreadcrumbItem` type to a shared types file for better code organization.
This commit is contained in:
@@ -19,6 +19,14 @@ export const API_ENDPOINTS = {
|
||||
UPDATE: (id: string) => `companies/${id}`,
|
||||
DELETE: (id: string) => `companies/${id}`,
|
||||
DETAILS: (id: string) => `companies/${id}`,
|
||||
CATEGORIES: {
|
||||
READ_ALL: "company-categories",
|
||||
CREATE: "company-categories",
|
||||
UPDATE: (id: string) => `company-categories/${id}`,
|
||||
DELETE: (id: string) => `company-categories/${id}`,
|
||||
DETAILS: (id: string) => `company-categories/${id}`,
|
||||
TOGGLE_PUBLISHED:(id:string) => `company-categories/${id}/publish`,
|
||||
},
|
||||
},
|
||||
TENDERS: {
|
||||
READ_ALL: "tenders",
|
||||
|
||||
Reference in New Issue
Block a user