diff --git a/src/app/LayoutCommon.astro b/src/app/LayoutCommon.astro index e3af13efc..bb7c02827 100644 --- a/src/app/LayoutCommon.astro +++ b/src/app/LayoutCommon.astro @@ -16,7 +16,6 @@ if (allEnvKeys.length === 0) { const exposedEnvKeys = allEnvKeys.filter((key) => !excludeKeys.includes(key)); const initData: Record = {}; -const excludedEnvData: Record = {}; allEnvKeys.forEach((key) => { const value = process.env[key] || import.meta.env[key]; diff --git a/src/config/SocketConfig.ts b/src/config/SocketConfig.ts index e83269398..2a5eef880 100644 --- a/src/config/SocketConfig.ts +++ b/src/config/SocketConfig.ts @@ -1,7 +1,7 @@ import { envConfig } from "./envConfig" import io from "socket.io-client" -const SOCKET = io(`${import.meta.env.PUBLIC_BASE_URL}`, { +const SOCKET = io(`${envConfig.PUBLIC_BASE_URL}`, { reconnection: true, reconnectionDelay: 500, reconnectionAttempts: Infinity, diff --git a/src/config/ssrApiConfig.ts b/src/config/ssrApiConfig.ts index 41563b67e..fba1e96a0 100644 --- a/src/config/ssrApiConfig.ts +++ b/src/config/ssrApiConfig.ts @@ -20,7 +20,7 @@ const API = async ({ token, url, method, payload }: IProps) => { method, body: JSON.stringify(payload), }; - const baseURL = globalThis.baseUrl || import.meta.env.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL; + const baseURL = globalThis.baseUrl || envConfig.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL; const apiURL = baseURL + url; const res = await fetch(apiURL, { ...config, diff --git a/src/pages/user/[user].astro b/src/pages/user/[user].astro index 09108b37d..2676742c1 100644 --- a/src/pages/user/[user].astro +++ b/src/pages/user/[user].astro @@ -1,10 +1,11 @@ --- import LogoFile from '../../commonComponents/LogoFile'; import CustomAvatar from '../../components/Avatar'; +import { envConfig } from '../../config/envConfig'; import { pathRoutes } from '../../config/pathRoutes'; const { user } = Astro.params; -const baseUrl = process.env.PUBLIC_BASE_URL || import.meta.env.PUBLIC_BASE_URL +const baseUrl = process.env.PUBLIC_BASE_URL || envConfig.PUBLIC_BASE_URL const response = await fetch(`${baseUrl}/users/public-profiles/${user}`); const data = await response.json(); const userData = data?.data; diff --git a/src/services/axiosIntercepter.ts b/src/services/axiosIntercepter.ts index c4f9181ee..32b5a58ba 100644 --- a/src/services/axiosIntercepter.ts +++ b/src/services/axiosIntercepter.ts @@ -6,7 +6,7 @@ import { getFromLocalStorage, setToLocalStorage } from '../api/Auth'; import { apiStatusCodes, storageKeys } from '../config/CommonConstant'; const instance = axios.create({ - baseURL: import.meta.env.PUBLIC_BASE_URL, + baseURL: envConfig.PUBLIC_BASE_URL, }); const EcosystemInstance = axios.create({ @@ -16,7 +16,7 @@ const EcosystemInstance = axios.create({ const checkAuthentication = async (sessionCookie: string, request: AxiosRequestConfig) => { const isAuthPage = window.location.href.includes('/authentication/sign-in') || window.location.href.includes('/authentication/sign-up') try { - const baseURL = import.meta.env.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL; + const baseURL = envConfig.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL; const config = { headers: { 'Content-Type': 'application/json', diff --git a/src/utils/check-session.ts b/src/utils/check-session.ts index 41a9f4bbc..1a1a8537a 100755 --- a/src/utils/check-session.ts +++ b/src/utils/check-session.ts @@ -33,7 +33,7 @@ export const checkUserSession = async ({ try { const baseURL = - import.meta.env.PUBLIC_BASE_URL || + envConfig.PUBLIC_BASE_URL || process.env.PUBLIC_BASE_URL; const config = { headers: {