Skip to content

Commit

Permalink
fixed advertiser buy and sell balance (#6803)
Browse files Browse the repository at this point in the history
  • Loading branch information
farrah-deriv committed Oct 25, 2022
1 parent 64a8957 commit 00ac5c9
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions packages/p2p/src/stores/general-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,25 @@ export default class GeneralStore extends BaseStore {
name,
}).then(response => {
const { sendbird_store, buy_sell_store } = this.root_store;
const { p2p_advertiser_create } = response;
const { error, p2p_advertiser_create } = response;
const {
daily_buy,
daily_buy_limit,
daily_sell,
daily_sell_limit,
id,
is_approved,
name: advertiser_name,
} = p2p_advertiser_create || {};

if (response.error) {
this.setNicknameError(response.error.message);
if (error) {
this.setNicknameError(error.message);
} else {
this.setAdvertiserId(p2p_advertiser_create.id);
this.setIsAdvertiser(!!p2p_advertiser_create.is_approved);
this.setNickname(p2p_advertiser_create.name);
this.setAdvertiserId(id);
this.setAdvertiserBuyLimit(daily_buy_limit - daily_buy);
this.setAdvertiserSellLimit(daily_sell_limit - daily_sell);
this.setIsAdvertiser(!!is_approved);
this.setNickname(advertiser_name);
this.setNicknameError(undefined);
sendbird_store.handleP2pAdvertiserInfo(response);
this.toggleNicknamePopup();
Expand Down

0 comments on commit 00ac5c9

Please sign in to comment.