passed reset and loading method inside handleSubmitForm function.
This commit is contained in:
parent
31e5a63fb7
commit
2ae3d2907b
@ -101,8 +101,8 @@ const ManageProjectInfo = ({ project, handleSubmitForm, onClose }) => {
|
||||
|
||||
const onSubmitForm = (updatedProject) => {
|
||||
setLoading(true);
|
||||
|
||||
handleSubmitForm( updatedProject ,setLoading);
|
||||
handleSubmitForm( updatedProject, setLoading,reset );
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
@ -66,13 +66,15 @@ const ProjectList = () => {
|
||||
}
|
||||
}, [loginUser, HasManageProjectPermission]);
|
||||
|
||||
const handleSubmitForm = (newProject) => {
|
||||
const handleSubmitForm = (newProject,setloading,reset) => {
|
||||
ProjectRepository.manageProject(newProject)
|
||||
.then((response) => {
|
||||
const cachedProjects = getCachedData("projectslist") || [];
|
||||
const updatedProjects = [...cachedProjects, response.data];
|
||||
cacheData("projectslist", updatedProjects);
|
||||
setProjectList((prev) => [...prev, response.data]);
|
||||
setProjectList( ( prev ) => [ ...prev, response.data ] );
|
||||
setloading( false )
|
||||
reset()
|
||||
showToast("Project Created successfully.", "success");
|
||||
setShowModal(false);
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user