This commit is contained in:
2024-06-25 15:56:48 +05:00
parent f9aec64c99
commit 68ab95ab22
2 changed files with 69 additions and 34 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
VITE_TEST_VAR=123 VITE_TEST_VAR=123
VITE_SERVER_API=http://192.168.56.1:3000 # VITE_SERVER_API=http://192.168.56.1:3000/
VITE_SERVER_API=https://irth.graff.tech/api
@@ -22,7 +22,6 @@ import SearchLoader from "./SearchLoader";
const LayoutOptions = () => { const LayoutOptions = () => {
const { apartments, setApartments } = useApartments(); const { apartments, setApartments } = useApartments();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
console.log("first", import.meta.env.VITE_TEST_VAR);
const { setModal } = useModal(); const { setModal } = useModal();
const { const {
@@ -68,23 +67,8 @@ const LayoutOptions = () => {
const zohoToken = localStorage.getItem("ACCESS_TOKEN"); const zohoToken = localStorage.getItem("ACCESS_TOKEN");
setIsLoading(true); setIsLoading(true);
getFilteredApartments( updateAccessToken()
zohoToken, .then((token) => {
setApartments,
roveHomeTypeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
)
.catch((error) => {
const errorStatus = error.response.status;
if (errorStatus === 401) {
updateAccessToken().then((token) => {
if (token) { if (token) {
getFilteredApartments( getFilteredApartments(
token, token,
@@ -99,12 +83,62 @@ const LayoutOptions = () => {
perPage perPage
); );
} }
});
}
}) })
.then(() =>
getFilteredApartments(
zohoToken,
setApartments,
roveHomeTypeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
)
)
.finally(() => { .finally(() => {
setIsLoading(false); setIsLoading(false);
}); });
// getFilteredApartments(
// zohoToken,
// setApartments,
// roveHomeTypeCheckboxes,
// apartmentTypeCheckboxes,
// debouncedSliders,
// switchers,
// viewCheckboxes,
// sortList,
// pageInitial,
// perPage
// )
// .catch((error) => {
// const errorStatus = error.response.status;
// if (errorStatus === 401) {
// updateAccessToken().then((token) => {
// if (token) {
// getFilteredApartments(
// token,
// setApartments,
// roveHomeTypeCheckboxes,
// apartmentTypeCheckboxes,
// debouncedSliders,
// switchers,
// viewCheckboxes,
// sortList,
// pageInitial,
// perPage
// );
// }
// });
// }
// })
// .finally(() => {
// setIsLoading(false);
// });
}, [ }, [
setApartments, setApartments,
roveHomeTypeCheckboxes, roveHomeTypeCheckboxes,