Skip to content

Commit 51535db

Browse files
committed
fix: enabled accounts check
1 parent a2037c6 commit 51535db

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/layout/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ const Layout = () => {
4040
const validateApiAccounts = ({ data }: any) => {
4141
if (data.msg_type === 'authorize') {
4242
const enabled_accounts = (data.authorize.account_list || []).filter((acc: any) => !acc.is_disabled);
43-
api_accounts.push(enabled_accounts);
43+
api_accounts.push(enabled_accounts || []);
4444

4545
const allCurrencies = new Set(Object.values(checkClientAccount).map(acc => acc.currency));
4646
let currency = 'USD';
47-
const hasMissingCurrency = enabled_accounts.some(account => {
48-
if (!allCurrencies.has(account.currency)) {
47+
const hasMissingCurrency = api_accounts?.flat().some(data => {
48+
if (!allCurrencies.has(data.currency)) {
4949
sessionStorage.setItem('query_param_currency', currency);
5050
return true;
5151
}
52-
currency = account.currency;
52+
currency = data.currency;
5353
return false;
5454
});
5555

0 commit comments

Comments
 (0)