Skip to content

Commit

Permalink
fix: fix login issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shafin-deriv committed Feb 6, 2025
1 parent fae3dba commit a453e27
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/components/shared/utils/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,15 @@ export const generateOAuthURL = () => {
const oauth_url = getOauthURL();
const original_url = new URL(oauth_url);
const configured_server_url = (LocalStorageUtils.getValue(LocalStorageConstants.configServerURL) ||
localStorage.getItem('config.server_url') ||
original_url.hostname) as string;

const valid_server_urls = ['green.derivws.com', 'red.derivws.com', 'blue.derivws.com'];
if (!valid_server_urls.includes(JSON.stringify(configured_server_url))) {
if (
typeof configured_server_url === 'string'
? !valid_server_urls.includes(configured_server_url)
: !valid_server_urls.includes(JSON.stringify(configured_server_url))
) {
original_url.hostname = configured_server_url;
}
return original_url.toString() || oauth_url;
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/utils/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const getDerivDomain = (service: Service): string => {
* Uses template literals to compose URLs dynamically.
*/
export const standalone_routes = {
bot: '/',
bot: `${window.location.origin}`,
cashier: `${getDerivDomain('derivApp')}/cashier/`,
cashier_deposit: `${getDerivDomain('derivApp')}/cashier/deposit`,
cashier_p2p: `${getDerivDomain('derivApp')}/cashier/p2p`,
Expand All @@ -78,7 +78,7 @@ export const standalone_routes = {
signup: `https://hub.deriv.com/tradershub/signup`,
deriv_com: getDerivDomain('derivCom'),
deriv_app: getDerivDomain('derivApp'),
endpoint: '/endpoint',
endpoint: `${window.location.origin}/endpoint`,
account_limits: `${getDerivDomain('derivApp')}/account/account-limits`,
help_center: `${getDerivDomain('derivCom')}/help-centre/`,
responsible: `${getDerivDomain('derivCom')}/responsible/`,
Expand Down

0 comments on commit a453e27

Please sign in to comment.