Skip to content

Commit

Permalink
chore: append app id only happens at login not ws (#17955)
Browse files Browse the repository at this point in the history
  • Loading branch information
suisin-deriv authored Jan 8, 2025
1 parent 68d1aec commit 2ac55e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/core/src/App/AppContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough }
const { isChangingToHubAppId } = useIsHubRedirectionEnabled();

const is_app_id_set = localStorage.getItem('config.app_id');
const is_change_login_app_id_set = localStorage.getItem('change_login_app_id');

const [isWebPasskeysFFEnabled, isGBLoaded] = useGrowthbookIsOn({
featureFlag: 'web_passkeys',
Expand Down Expand Up @@ -115,9 +116,11 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough }
React.useEffect(() => {
if (isChangingToHubAppId && !is_app_id_set) {
const app_id = process.env.NODE_ENV === 'production' ? 61554 : 53503;
localStorage.setItem('config.app_id', app_id.toString());
localStorage.setItem('change_login_app_id', app_id.toString());
return;
}
}, [isChangingToHubAppId, is_app_id_set]);
is_change_login_app_id_set && localStorage.removeItem('change_login_app_id');
}, [isChangingToHubAppId, is_app_id_set, is_change_login_app_id_set]);

React.useEffect(() => {
switchLanguage(current_language);
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/src/utils/login/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type TLoginUrl = {

export const loginUrl = ({ language }: TLoginUrl) => {
const server_url = LocalStore.get('config.server_url');
const change_login_app_id = LocalStore.get('change_login_app_id');
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const signup_device_cookie = new (CookieStorage as any)('signup_device');
const signup_device = signup_device_cookie.get('signup_device');
Expand All @@ -38,7 +39,7 @@ export const loginUrl = ({ language }: TLoginUrl) => {
const getOAuthUrl = () => {
return `https://oauth.${
deriv_urls.DERIV_HOST_NAME
}/oauth2/authorize?app_id=${getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`;
}/oauth2/authorize?app_id=${change_login_app_id || getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`;
};

if (server_url && /qa/.test(server_url)) {
Expand Down

0 comments on commit 2ac55e6

Please sign in to comment.