Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 6f241b9

Browse files
Hubert KosterHubert Koster
authored andcommitted
chore: refactoring urls
1 parent bc013ec commit 6f241b9

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

src/features/Endpoint/Endpoint.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { useForm } from 'react-hook-form';
33
import { Button, Text } from '@deriv/ui';
44
import { getAppId } from '@site/src/utils';
5+
import { OAUTH_URL } from '@site/src/utils/constants';
56
import styles from './Endpoint.module.scss';
67

78
interface IEndpointFormValues {
@@ -11,7 +12,7 @@ interface IEndpointFormValues {
1112
const EndPoint = () => {
1213
const default_endpoint = {
1314
app_id: getAppId(false),
14-
server_url: 'oauth.deriv.com',
15+
server_url: OAUTH_URL,
1516
};
1617

1718
const {

src/hooks/useLoginUrl/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useCallback } from 'react';
33

44
const useLoginUrl = () => {
55
const getUrl = useCallback((language = 'en') => {
6-
const { appId, serverUrl } = getServerConfig();
7-
return generateLoginUrl(language, serverUrl, appId);
6+
const { appId, oauth } = getServerConfig();
7+
return generateLoginUrl(language, oauth, appId);
88
}, []);
99

1010
return { getUrl };

src/utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export const STAGING_APP_ID = '36545';
33
export const VERCEL_DEPLOYMENT_APP_ID = '35073';
44
export const LOCALHOST_APP_ID = '35074';
55
export const DEFAULT_WS_SERVER = 'ws.binaryws.com';
6+
export const OAUTH_URL = 'oauth.deriv.com';
67

78
export const LOGIN_ACCOUNTS_SESSION_STORAGE_KEY = 'login-accounts';
89
export const CURRENT_LOGIN_ACCOUNT_SESSION_STORAGE_KEY = 'current-login-account';

src/utils/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
PRODUCTION_APP_ID,
88
STAGING_APP_ID,
99
VERCEL_DEPLOYMENT_APP_ID,
10+
OAUTH_URL,
1011
} from './constants';
1112

1213
const CURRENCY_MAP = new Map([
@@ -130,18 +131,21 @@ export const getServerConfig = () => {
130131
return {
131132
serverUrl: config_server_url,
132133
appId: config_app_id,
134+
oauth: OAUTH_URL,
133135
};
134136
} else {
135137
const isLocalHost = isHost('localhost');
136138
return {
137139
serverUrl: DEFAULT_WS_SERVER,
138140
appId: getAppId(isLocalHost),
141+
oauth: OAUTH_URL,
139142
};
140143
}
141144
} else {
142145
return {
143146
serverUrl: DEFAULT_WS_SERVER,
144147
appId: getAppId(false),
148+
oauth: OAUTH_URL,
145149
};
146150
}
147151
};

0 commit comments

Comments
 (0)