This commit is contained in:
2024-06-25 16:52:17 +05:00
parent 68ab95ab22
commit 1a008c9a5d
7 changed files with 86 additions and 64 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
VITE_TEST_VAR=123
# VITE_SERVER_API=http://192.168.56.1:3000/
# VITE_SERVER_API=http://192.168.1.158:3002
VITE_SERVER_API=https://irth.graff.tech/api
+1
View File
@@ -31,6 +31,7 @@
"zustand": "^4.5.2"
},
"devDependencies": {
"@types/node": "^20.14.8",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@types/react-transition-group": "^4.4.10",
@@ -67,8 +67,8 @@ const LayoutOptions = () => {
const zohoToken = localStorage.getItem("ACCESS_TOKEN");
setIsLoading(true);
updateAccessToken()
.then((token) => {
if (!zohoToken) {
updateAccessToken().then((token) => {
if (token) {
getFilteredApartments(
token,
@@ -81,64 +81,52 @@ const LayoutOptions = () => {
sortList,
pageInitial,
perPage
);
).then(() => {
setIsLoading(false);
});
}
})
.then(() =>
getFilteredApartments(
zohoToken,
setApartments,
roveHomeTypeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
)
)
.finally(() => {
setIsLoading(false);
});
} else {
getFilteredApartments(
zohoToken,
setApartments,
roveHomeTypeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
)
.catch((error) => {
const errorStatus = error.response.status;
// 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);
// });
if (errorStatus === 401) {
updateAccessToken().then((token) => {
if (token) {
getFilteredApartments(
token,
setApartments,
roveHomeTypeCheckboxes,
apartmentTypeCheckboxes,
debouncedSliders,
switchers,
viewCheckboxes,
sortList,
pageInitial,
perPage
).then(() => {
setIsLoading(false);
});
}
});
}
})
.then(() => {
setIsLoading(false);
});
}
}, [
setApartments,
roveHomeTypeCheckboxes,
+18 -5
View File
@@ -1,7 +1,20 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
return {
plugins: [react()],
server: {
proxy: {
"/api": {
target: process.env.VITE_SERVER_API,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
};
});
+12
View File
@@ -709,6 +709,13 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
"@types/node@^20.14.8":
version "20.14.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.8.tgz#45c26a2a5de26c3534a9504530ddb3b27ce031ac"
integrity sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==
dependencies:
undici-types "~5.26.4"
"@types/offscreencanvas@^2019.6.4":
version "2019.7.3"
resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz#90267db13f64d6e9ccb5ae3eac92786a7c77a516"
@@ -2622,6 +2629,11 @@ ua-parser-js@^1.0.33:
resolved "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-1.0.37.tgz"
integrity sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ==
undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==
update-browserslist-db@^1.0.13:
version "1.0.13"
resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz"
+1 -1
View File
@@ -1,2 +1,2 @@
PORT=3000
PORT=3002
REFRESH_TOKEN=1000.da3146d49fa8a399f0c635e74954ff9c.e010dbb1bb605d7e1aa5bf7fc0521f8b
+8
View File
@@ -0,0 +1,8 @@
module.exports = {
apps: [
{
name: "irth-server:3002",
script: "./dist",
},
],
};