Skip to content

Commit 56a3167

Browse files
committed
chore: resolved pr comments
1 parent 232f914 commit 56a3167

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/constants/url.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ export const HELP_CENTRE = `${URLConstants.derivComProduction}/help-centre/`;
1414
export const RESPONSIBLE = `${URLConstants.derivComProduction}/responsible/`;
1515

1616
const SocketURL = {
17-
'p2p.deriv.com': 'blue.derivws.com',
18-
'staging-p2p.deriv.com': 'red.derivws.com',
17+
[URLConstants.derivP2pProduction]: 'blue.derivws.com',
18+
[URLConstants.derivP2pStaging]: 'red.derivws.com',
1919
};
2020

2121
export const getOauthUrl = () => {
22-
const hostname = window.location.hostname;
22+
const hostname = window.location.origin;
2323

2424
// since we don't have official app_id for staging,
2525
// we will use the red server with app_id=62019 for the staging-p2p.deriv.com for now
2626
// to fix the login issue
27-
if (hostname === 'staging-p2p.deriv.com') {
27+
if (hostname === URLConstants.derivP2pStaging) {
2828
localStorage.setItem(
2929
LocalStorageConstants.configServerURL.toString(),
3030
SocketURL[hostname as keyof typeof SocketURL]
@@ -35,7 +35,8 @@ export const getOauthUrl = () => {
3535
);
3636
}
3737

38-
const serverUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString());
38+
const storedServerUrl = localStorage.getItem(LocalStorageConstants.configServerURL.toString());
39+
const serverUrl = /qa/.test(storedServerUrl || '') ? storedServerUrl : 'oauth.deriv.com';
3940

4041
const appId = LocalStorageUtils.getValue(LocalStorageConstants.configAppId);
4142

0 commit comments

Comments
 (0)