added form submission logic with loading state management #78

Merged
vikas.nale merged 1 commits from pramod_Bug#196 into Issue_May_2W 2025-05-08 05:39:25 +00:00
2 changed files with 9 additions and 8 deletions

View File

@ -98,12 +98,13 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
const onSubmitForm = (updatedProject) => {
setLoading(true);
handleSubmitForm(updatedProject);
handleSubmitForm( updatedProject ,setLoading);
};
useEffect(() => {
return () => setLoading(false);
}, []);
return (
<div
@ -269,8 +270,8 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
)}
</div>
<div className="col-12 text-center">
<button type="submit" className="btn btn-sm btn-primary me-3">
{isloading ? "Please Wait" : project?.id ? "Update" : "Submit"}
<button type="submit" className="btn btn-sm btn-primary me-3" disabled={isloading}>
{isloading ? "Please Wait..." : project?.id ? "Update" : "Submit"}
</button>
<button
type="button"

View File

@ -21,7 +21,7 @@ const ProjectBanner = ( {project_data} ) =>
const handleShow = () => setShowModal(true);
const handleClose = () => setShowModal(false);
const handleFormSubmit = ( updatedProject ) =>
const handleFormSubmit = ( updatedProject,setLoading ) =>
{
if ( CurrentProject?.id )
@ -51,7 +51,7 @@ const ProjectBanner = ( {project_data} ) =>
}
showToast( "Project updated successfully.", "success" );
setLoading(false)
setShowModal(false)
})
.catch((error) => {