@mx-cartographer/experiences 3.1.2-alpha.bb1 → 3.1.2-alpha.bb2

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@ export declare class AccountStore {
15
15
  get cashAccounts(): Account[];
16
16
  get cashBalance(): number;
17
17
  addAccount: (account: Account) => Promise<void>;
18
- augmentAccounts: (accounts?: Account[]) => void;
18
+ augmentAccounts: (accounts?: Account[]) => Account[];
19
19
  loadAccounts: () => Promise<void>;
20
20
  loadInstitutions: () => Promise<void>;
21
21
  loadMembers: () => Promise<void>;
@@ -25,7 +25,7 @@ export declare class AccountStore {
25
25
  mode?: string | undefined;
26
26
  }) => Promise<any>;
27
27
  mergeAccounts: (accountGuids: string[]) => Promise<void>;
28
- sortAccounts: (accounts?: Account[]) => void;
28
+ sortAccounts: (accounts?: Account[]) => Account[];
29
29
  refreshAccounts: () => void;
30
30
  refreshMembers: () => Promise<void>;
31
31
  removeAccount: (accountGuid: string) => Promise<void>;
package/dist/index.es.js CHANGED
@@ -10671,7 +10671,7 @@ class t1 {
10671
10671
  };
10672
10672
  augmentAccounts = (e = this.accounts) => {
10673
10673
  const n = [];
10674
- console.log("Store | members", [...this.members]), e.forEach((a) => {
10674
+ return e.forEach((a) => {
10675
10675
  const r = this.members.findIndex(
10676
10676
  (i) => i.guid === a.member_guid
10677
10677
  );
@@ -10684,14 +10684,20 @@ class t1 {
10684
10684
  connectionStatus: i
10685
10685
  }), this.members[r].connectionStatus = i;
10686
10686
  }
10687
- }), this.sortAccounts(n), console.log("Store | augmentedAccounts: ", n);
10687
+ }), n;
10688
10688
  };
10689
10689
  loadAccounts = async () => {
10690
- this.loadMembers();
10691
- const e = await this.api.getAccounts();
10692
- console.log("Store | accounts: ", [...e]), V(() => {
10693
- this.augmentAccounts(e);
10694
- });
10690
+ await this.loadMembers();
10691
+ try {
10692
+ const e = await this.api.getAccounts();
10693
+ V(() => {
10694
+ this.accounts = this.sortAccounts(
10695
+ this.augmentAccounts(e)
10696
+ );
10697
+ });
10698
+ } catch (e) {
10699
+ console.error(`Error occurred while loading accounts: ${e}`);
10700
+ }
10695
10701
  };
10696
10702
  loadInstitutions = async () => {
10697
10703
  try {
@@ -10729,9 +10735,7 @@ class t1 {
10729
10735
  console.error(`Error occurred while merging accounts: ${n}`);
10730
10736
  }
10731
10737
  };
10732
- sortAccounts = (e = this.accounts) => {
10733
- this.accounts = e.sort((n, a) => n.account_type > a.account_type ? 1 : n.account_type < a.account_type ? -1 : (n.name || "") > (a.name || "") ? 1 : (n.name || "") < (a.name || "") ? -1 : 0);
10734
- };
10738
+ sortAccounts = (e = this.accounts) => e.sort((n, a) => n.account_type > a.account_type ? 1 : n.account_type < a.account_type ? -1 : (n.name || "") > (a.name || "") ? 1 : (n.name || "") < (a.name || "") ? -1 : 0);
10735
10739
  refreshAccounts = () => {
10736
10740
  this.uiStore.setIsLoading(!0), Promise.all([this.loadAccounts(), this.loadInstitutions()]), this.uiStore.setIsLoading(!1);
10737
10741
  };