React Query Integration for Server State Sync in Clinet #245
@ -7,6 +7,7 @@ import {useHasUserPermission} from "../../hooks/useHasUserPermission";
|
|||||||
import {MANAGE_PROJECT} from "../../utils/constants";
|
import {MANAGE_PROJECT} from "../../utils/constants";
|
||||||
import GlobalModel from "../common/GlobalModel";
|
import GlobalModel from "../common/GlobalModel";
|
||||||
import ManageProjectInfo from "./ManageProjectInfo";
|
import ManageProjectInfo from "./ManageProjectInfo";
|
||||||
|
import {useQueryClient} from "@tanstack/react-query";
|
||||||
const AboutProject = () =>
|
const AboutProject = () =>
|
||||||
{
|
{
|
||||||
const [ IsOpenModal, setIsOpenModal ] = useState( false )
|
const [ IsOpenModal, setIsOpenModal ] = useState( false )
|
||||||
@ -15,7 +16,8 @@ const AboutProject = () =>
|
|||||||
{
|
{
|
||||||
setIsOpenModal(false)
|
setIsOpenModal(false)
|
||||||
}
|
}
|
||||||
})
|
} )
|
||||||
|
const ClientQuery = useQueryClient()
|
||||||
const {projectId} = useParams();
|
const {projectId} = useParams();
|
||||||
const manageProject = useHasUserPermission(MANAGE_PROJECT);
|
const manageProject = useHasUserPermission(MANAGE_PROJECT);
|
||||||
const {projects_Details, isLoading, error,refetch} = useProjectDetails( projectId )
|
const {projects_Details, isLoading, error,refetch} = useProjectDetails( projectId )
|
||||||
@ -23,9 +25,10 @@ const AboutProject = () =>
|
|||||||
{
|
{
|
||||||
if ( projects_Details?.id )
|
if ( projects_Details?.id )
|
||||||
{
|
{
|
||||||
|
ClientQuery.invalidateQueries({queryKey:["projectInfo"]})
|
||||||
UpdateProjectDetails({ projectId: projects_Details?.id,updatedData: updatedProject,
|
UpdateProjectDetails({ projectId: projects_Details?.id,updatedData: updatedProject,
|
||||||
} );
|
} );
|
||||||
refetch()
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
|
@ -108,6 +108,7 @@ export const useReportTask = ( {onSuccessCallback, onErrorCallback} = {} ) =>
|
|||||||
const {workAreaId} = variables;
|
const {workAreaId} = variables;
|
||||||
queryClient.invalidateQueries( {queryKey: [ "taskList" ]} );
|
queryClient.invalidateQueries( {queryKey: [ "taskList" ]} );
|
||||||
queryClient.invalidateQueries( {queryKey: [ "WorkItems", workAreaId ]} );
|
queryClient.invalidateQueries( {queryKey: [ "WorkItems", workAreaId ]} );
|
||||||
|
queryClient.invalidateQueries( {queryKey: [ 'ProjectsList' ]} );
|
||||||
showToast( "Task Reported Successfully.", "success" );
|
showToast( "Task Reported Successfully.", "success" );
|
||||||
if (onSuccessCallback) onSuccessCallback(data);
|
if (onSuccessCallback) onSuccessCallback(data);
|
||||||
},
|
},
|
||||||
|
@ -109,8 +109,7 @@ export function startSignalR(loggedUser) {
|
|||||||
queryClient.invalidateQueries(['allEmployee', false]);
|
queryClient.invalidateQueries(['allEmployee', false]);
|
||||||
queryClient.invalidateQueries(['employeeProfile', data.response?.employeeId]);
|
queryClient.invalidateQueries(['employeeProfile', data.response?.employeeId]);
|
||||||
queryClient.invalidateQueries(['employeeListByProject']); // optional if scope
|
queryClient.invalidateQueries(['employeeListByProject']); // optional if scope
|
||||||
queryClient
|
eventBus.emit("employee", data);
|
||||||
eventBus.emit("employee", data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.keyword == "Task_Report") {
|
if (data.keyword == "Task_Report") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user