Skip to content

Commit a2037c6

Browse files
committed
fix: added disable account check
1 parent 5ed60c1 commit a2037c6

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/components/layout/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ const Layout = () => {
3939

4040
const validateApiAccounts = ({ data }: any) => {
4141
if (data.msg_type === 'authorize') {
42-
api_accounts.push(data.authorize.account_list || []);
42+
const enabled_accounts = (data.authorize.account_list || []).filter((acc: any) => !acc.is_disabled);
43+
api_accounts.push(enabled_accounts);
44+
4345
const allCurrencies = new Set(Object.values(checkClientAccount).map(acc => acc.currency));
4446
let currency = 'USD';
45-
const hasMissingCurrency = api_accounts?.flat().some(data => {
46-
if (!allCurrencies.has(data.currency)) {
47+
const hasMissingCurrency = enabled_accounts.some(account => {
48+
if (!allCurrencies.has(account.currency)) {
4749
sessionStorage.setItem('query_param_currency', currency);
4850
return true;
4951
}
50-
currency = data.currency;
52+
currency = account.currency;
5153
return false;
5254
});
5355

@@ -59,7 +61,7 @@ const Layout = () => {
5961
}
6062

6163
if (subscription) {
62-
subscription?.unsubscribe();
64+
subscription.unsubscribe();
6365
}
6466
}
6567
};

src/external/bot-skeleton/services/api/api-base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ class APIBase {
171171
this.active_symbols_promise = this.getActiveSymbols();
172172
}
173173
this.account_info = authorize;
174-
setAccountList(authorize.account_list);
174+
const filtered_accounts = (authorize?.account_list || []).filter(acc => !acc?.is_disabled);
175+
setAccountList(filtered_accounts);
175176
setAuthData(authorize);
176177
setIsAuthorized(true);
177178
this.is_authorized = true;

0 commit comments

Comments
 (0)