Skip to content

Commit b6e8edb

Browse files
committed
chore: resolved pr comments
1 parent a331375 commit b6e8edb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/constants/url.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export const getOauthUrl = () => {
2323
const hostname = window.location.hostname;
2424

2525
const existingAppId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId);
26-
const existingServerUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString());
26+
const existingServerUrl = LocalStorageUtils.getValue(LocalStorageConstants.configServerURL);
2727
// since we don't have official app_id for staging,
2828
// we will use the red server with app_id=62019 for the staging-p2p.deriv.com for now
2929
// to fix the login issue
30-
if ((!existingAppId || !existingServerUrl) && origin === URLConstants.derivP2pStaging) {
30+
if (!/localhost/.test(origin) && (!existingAppId || !existingServerUrl)) {
3131
localStorage.setItem(
3232
LocalStorageConstants.configServerURL.toString(),
3333
SocketURL[origin as keyof typeof SocketURL]
@@ -38,8 +38,8 @@ export const getOauthUrl = () => {
3838
);
3939
}
4040

41-
const storedServerUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString());
42-
const serverUrl = /qa/.test(storedServerUrl || '') ? storedServerUrl : 'oauth.deriv.com';
41+
const storedServerUrl = LocalStorageUtils.getValue(LocalStorageConstants.configServerURL);
42+
const serverUrl = /qa/.test(String(storedServerUrl)) ? storedServerUrl : 'oauth.deriv.com';
4343

4444
const appId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId);
4545

0 commit comments

Comments
 (0)