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