From b6e8edbd2c31791c60ac48c9a7c88ec9dcdf3920 Mon Sep 17 00:00:00 2001 From: shayan khaleghparast Date: Wed, 19 Jun 2024 19:06:03 +0800 Subject: [PATCH] chore: resolved pr comments --- src/constants/url.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/constants/url.ts b/src/constants/url.ts index 36cfdd12..7a15f085 100644 --- a/src/constants/url.ts +++ b/src/constants/url.ts @@ -23,11 +23,11 @@ export const getOauthUrl = () => { const hostname = window.location.hostname; const existingAppId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId); - const existingServerUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString()); + const existingServerUrl = LocalStorageUtils.getValue(LocalStorageConstants.configServerURL); // since we don't have official app_id for staging, // we will use the red server with app_id=62019 for the staging-p2p.deriv.com for now // to fix the login issue - if ((!existingAppId || !existingServerUrl) && origin === URLConstants.derivP2pStaging) { + if (!/localhost/.test(origin) && (!existingAppId || !existingServerUrl)) { localStorage.setItem( LocalStorageConstants.configServerURL.toString(), SocketURL[origin as keyof typeof SocketURL] @@ -38,8 +38,8 @@ export const getOauthUrl = () => { ); } - const storedServerUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString()); - const serverUrl = /qa/.test(storedServerUrl || '') ? storedServerUrl : 'oauth.deriv.com'; + const storedServerUrl = LocalStorageUtils.getValue(LocalStorageConstants.configServerURL); + const serverUrl = /qa/.test(String(storedServerUrl)) ? storedServerUrl : 'oauth.deriv.com'; const appId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId);