@@ -14,17 +14,17 @@ export const HELP_CENTRE = `${URLConstants.derivComProduction}/help-centre/`;
14
14
export const RESPONSIBLE = `${ URLConstants . derivComProduction } /responsible/` ;
15
15
16
16
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' ,
19
19
} ;
20
20
21
21
export const getOauthUrl = ( ) => {
22
- const hostname = window . location . hostname ;
22
+ const hostname = window . location . origin ;
23
23
24
24
// since we don't have official app_id for staging,
25
25
// we will use the red server with app_id=62019 for the staging-p2p.deriv.com for now
26
26
// to fix the login issue
27
- if ( hostname === 'staging-p2p.deriv.com' ) {
27
+ if ( hostname === URLConstants . derivP2pStaging ) {
28
28
localStorage . setItem (
29
29
LocalStorageConstants . configServerURL . toString ( ) ,
30
30
SocketURL [ hostname as keyof typeof SocketURL ]
@@ -35,7 +35,8 @@ export const getOauthUrl = () => {
35
35
) ;
36
36
}
37
37
38
- const serverUrl = localStorage . getItem ( LocalStorageConstants . configServerURL . toString ( ) ) ;
38
+ const storedServerUrl = localStorage . getItem ( LocalStorageConstants . configServerURL . toString ( ) ) ;
39
+ const serverUrl = / q a / . test ( storedServerUrl || '' ) ? storedServerUrl : 'oauth.deriv.com' ;
39
40
40
41
const appId = LocalStorageUtils . getValue ( LocalStorageConstants . configAppId ) ;
41
42
0 commit comments