Skip to content

Commit

Permalink
fix: enabled accounts check
Browse files Browse the repository at this point in the history
  • Loading branch information
rupato-deriv committed Mar 4, 2025
1 parent a2037c6 commit 51535db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ const Layout = () => {
const validateApiAccounts = ({ data }: any) => {
if (data.msg_type === 'authorize') {
const enabled_accounts = (data.authorize.account_list || []).filter((acc: any) => !acc.is_disabled);
api_accounts.push(enabled_accounts);
api_accounts.push(enabled_accounts || []);

const allCurrencies = new Set(Object.values(checkClientAccount).map(acc => acc.currency));
let currency = 'USD';
const hasMissingCurrency = enabled_accounts.some(account => {
if (!allCurrencies.has(account.currency)) {
const hasMissingCurrency = api_accounts?.flat().some(data => {
if (!allCurrencies.has(data.currency)) {
sessionStorage.setItem('query_param_currency', currency);
return true;
}
currency = account.currency;
currency = data.currency;
return false;
});

Expand Down

0 comments on commit 51535db

Please sign in to comment.