Skip to content

Commit

Permalink
Jim/88166/delay in real account creation flow after clicking add acco…
Browse files Browse the repository at this point in the history
…unt button in the account creation popup (#7926)

* chore: remove duplicate get_settings api request

* chore: set account_settings in client-store if undefined

* chore: remove unnecessary else block

* refactor: convert if expression to ternary

* chore: set account_settings in client store instead of creating a local variable
  • Loading branch information
jim-deriv authored Mar 21, 2023
1 parent 19b3dc8 commit 8bb1351
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ export default class ClientStore extends BaseStore {
new_data.landing_company_shortcode = authorize_response.authorize.landing_company_name;
runInAction(() => (client_accounts[client_id] = new_data));
this.setLoginInformation(client_accounts, client_id);
WS.authorized.storage.getSettings().then(get_settings_response => {
WS.authorized.getSettings().then(get_settings_response => {
this.setAccountSettings(get_settings_response.get_settings);
resolve();
});
Expand Down Expand Up @@ -1659,14 +1659,16 @@ export default class ClientStore extends BaseStore {
statement: 1,
})
);
const account_settings = (await WS.authorized.cache.getSettings()).get_settings;
if (account_settings) this.setPreferredLanguage(account_settings.preferred_language);

if (Object.keys(this.account_settings).length === 0) {
this.setAccountSettings((await WS.authorized.getSettings()).get_settings);
}
if (this.account_settings) this.setPreferredLanguage(this.account_settings.preferred_language);
await this.fetchResidenceList();
await this.getTwoFAStatus();
if (account_settings && !account_settings.residence) {
if (this.account_settings && !this.account_settings.residence) {
this.root_store.ui.toggleSetResidenceModal(true);
}

await WS.authorized.cache.landingCompany(this.residence).then(this.responseLandingCompany);
if (!this.is_virtual) await this.getLimits();

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/_common/base/socket_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const SocketCache = (() => {
contracts_for: { expire: 10 },
exchange_rates: { expire: 60 },
trading_times: { expire: 120 },
get_settings: { expire: 10 },
// TODO: Enable statement and trade table caching once we have UI design for handling
// transitions between cached table and newly added data to table
// statement : { expire: 10 },
Expand Down

0 comments on commit 8bb1351

Please sign in to comment.