Skip to content

Commit

Permalink
fix: resolved login issue (#844)
Browse files Browse the repository at this point in the history
* fix: Improve Handling of Sensitive Data in Browser

Signed-off-by: bhavanakarwade <[email protected]>

* improved error handling for layout component

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: improve variables initialization logic

Signed-off-by: bhavanakarwade <[email protected]>

* removed hardcoded variables

Signed-off-by: bhavanakarwade <[email protected]>

* added file path in yml file

Signed-off-by: bhavanakarwade <[email protected]>

* refactor: added variable in constants file

Signed-off-by: bhavanakarwade <[email protected]>

* fix: signin issue

Signed-off-by: bhavanakarwade <[email protected]>

---------

Signed-off-by: bhavanakarwade <[email protected]>
  • Loading branch information
bhavanakarwade authored Dec 23, 2024
1 parent a4f8a93 commit d7b19c7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/app/LayoutCommon.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ if (allEnvKeys.length === 0) {
const exposedEnvKeys = allEnvKeys.filter((key) => !excludeKeys.includes(key));
const initData: Record<string, any> = {};
const excludedEnvData: Record<string, any> = {};
allEnvKeys.forEach((key) => {
const value = process.env[key] || import.meta.env[key];
Expand Down
2 changes: 1 addition & 1 deletion src/config/SocketConfig.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/config/ssrApiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/user/[user].astro
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/services/axiosIntercepter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/check-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit d7b19c7

Please sign in to comment.