React Query Integration for Server State Sync in Clinet #245
@ -32,7 +32,7 @@ const ProjectList = () => {
|
||||
const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT);
|
||||
const [HasManageProject, setHasManageProject] = useState(HasManageProjectPermission);
|
||||
|
||||
const { mutate: createProject } = useCreateProject({
|
||||
const { mutate: createProject,isPending } = useCreateProject({
|
||||
onSuccessCallback: () => {
|
||||
setShowModal(false);
|
||||
},
|
||||
@ -78,20 +78,14 @@ const ProjectList = () => {
|
||||
if (!loading && projects) {
|
||||
sortingProject(projects);
|
||||
}
|
||||
}, [projects, loading, selectedStatuses]); // Include selectedStatuses if it changes filtering
|
||||
}, [projects, loading, selectedStatuses]);
|
||||
|
||||
useEffect(() => {
|
||||
setHasManageProject(loginUser ? HasManageProjectPermission : false);
|
||||
}, [loginUser, HasManageProjectPermission]);
|
||||
|
||||
const handleSubmitForm = (newProject, setLoading, reset) => {
|
||||
setLoading(true);
|
||||
createProject(newProject, {
|
||||
onSettled: () => {
|
||||
setLoading(false);
|
||||
reset();
|
||||
},
|
||||
});
|
||||
const handleSubmitForm = (newProject) => {
|
||||
createProject(newProject);
|
||||
};
|
||||
|
||||
const handleStatusChange = (statusId) => {
|
||||
@ -140,6 +134,7 @@ const ProjectList = () => {
|
||||
project={null}
|
||||
handleSubmitForm={handleSubmitForm}
|
||||
onClose={handleClose}
|
||||
isPending={isPending}
|
||||
/>
|
||||
</GlobalModel>
|
||||
)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user