fixed reduant api calling
This commit is contained in:
parent
2f24d4a7ff
commit
ee1887de8f
@ -19,7 +19,7 @@ export const DocumentContext = createContext();
|
||||
export const useDocumentContext = () => {
|
||||
const context = useContext(DocumentContext);
|
||||
if (!context) {
|
||||
throw new Error("useExpenseContext must be used within an ExpenseProvider");
|
||||
throw new Error("useDocumentContext must be used within an DocumentProvider");
|
||||
}
|
||||
return context;
|
||||
};
|
||||
@ -29,6 +29,7 @@ const Documents = ({ Document_Entity, Entity }) => {
|
||||
const [filters, setFilter] = useState();
|
||||
const [isRefetching, setIsRefetching] = useState(false);
|
||||
const [refetchFn, setRefetchFn] = useState(null);
|
||||
const [DocumentEntity,setDocumentEntity] = useState(Document_Entity)
|
||||
const { employeeId } = useParams();
|
||||
const [ManageDoc, setManageDoc] = useState({
|
||||
document: null,
|
||||
@ -54,7 +55,7 @@ const Documents = ({ Document_Entity, Entity }) => {
|
||||
setShowTrigger(true);
|
||||
setOffcanvasContent(
|
||||
"Document Filters",
|
||||
<DocumentFilterPanel entityTypeId={Document_Entity} onApply={setFilter} />
|
||||
<DocumentFilterPanel entityTypeId={DocumentEntity} onApply={setFilter} />
|
||||
);
|
||||
|
||||
return () => {
|
||||
@ -68,6 +69,11 @@ const Documents = ({ Document_Entity, Entity }) => {
|
||||
setManageDoc,
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
if(Document_Entity){
|
||||
setDocumentEntity(Document_Entity)
|
||||
}
|
||||
},[Document_Entity])
|
||||
return (
|
||||
<DocumentContext.Provider value={contextValues}>
|
||||
|
||||
@ -118,7 +124,7 @@ const Documents = ({ Document_Entity, Entity }) => {
|
||||
</div>
|
||||
</div>
|
||||
<DocumentsList
|
||||
Document_Entity={Document_Entity}
|
||||
Document_Entity={DocumentEntity}
|
||||
Entity={Entity}
|
||||
filters={filters}
|
||||
searchText={searchText}
|
||||
@ -144,7 +150,7 @@ const Documents = ({ Document_Entity, Entity }) => {
|
||||
isOpen: false,
|
||||
})
|
||||
}
|
||||
Document_Entity={Document_Entity}
|
||||
Document_Entity={DocumentEntity}
|
||||
Entity={Entity}
|
||||
/>
|
||||
</GlobalModel>
|
||||
|
@ -203,7 +203,7 @@ const {
|
||||
isError,
|
||||
isLoading
|
||||
} = useQuery({
|
||||
queryKey: ["Document Category"],
|
||||
queryKey: ["Document Category",EntityType],
|
||||
queryFn: async () => {
|
||||
const res = await MasterRespository.getDocumentCategories(EntityType)
|
||||
return res.data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user