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