Skip to content

Commit

Permalink
Merge pull request #143 from shayan-deriv/master
Browse files Browse the repository at this point in the history
fix: fixed endpoint can't be set manually
  • Loading branch information
farrah-deriv authored Jun 19, 2024
2 parents b2e10c0 + b6e8edb commit 38602b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/constants/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export const getOauthUrl = () => {
const origin = window.location.origin;
const hostname = window.location.hostname;

const existingAppId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId);
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 (origin === URLConstants.derivP2pStaging) {
if (!/localhost/.test(origin) && (!existingAppId || !existingServerUrl)) {
localStorage.setItem(
LocalStorageConstants.configServerURL.toString(),
SocketURL[origin as keyof typeof SocketURL]
Expand All @@ -36,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);

Expand Down

0 comments on commit 38602b6

Please sign in to comment.