solve bug of two polygon editable
This commit is contained in:
30
src/lib/hooks/useInquiryPrivacyState.js
Normal file
30
src/lib/hooks/useInquiryPrivacyState.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { GET_INQUIRY_PRIVACY_STATE_LIST } from "@/core/utils/routes";
|
||||
import useRequest from "@/lib/hooks/useRequest";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const useInquiryPrivacyState = () => {
|
||||
const requestServer = useRequest();
|
||||
const [itemsList, setItemsList] = useState([]);
|
||||
const [loadingItemsList, setLoadingItemsList] = useState(true);
|
||||
const [errorItemsList, setErrorItemsList] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchItems = async () => {
|
||||
try {
|
||||
const response = await requestServer(`${GET_INQUIRY_PRIVACY_STATE_LIST}`);
|
||||
setItemsList(response.data.data);
|
||||
setLoadingItemsList(false);
|
||||
setErrorItemsList(false);
|
||||
} catch (e) {
|
||||
setErrorItemsList(e);
|
||||
setLoadingItemsList(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchItems();
|
||||
}, []);
|
||||
|
||||
return { itemsList, loadingItemsList, errorItemsList };
|
||||
};
|
||||
|
||||
export default useInquiryPrivacyState;
|
||||
Reference in New Issue
Block a user