Skip to content

Commit 934b933

Browse files
committed
more refactor
1 parent c98c8fd commit 934b933

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

services/static-webserver/client/source/class/osparc/study/BillingSettings.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,36 @@ qx.Class.define("osparc.study.BillingSettings", {
9090
if (walletId === null) {
9191
return;
9292
}
93-
boxContent.setEnabled(false);
94-
const paramsPut = {
95-
url: {
96-
studyId: this.__studyData["uuid"],
97-
walletId
98-
}
99-
};
100-
osparc.data.Resources.fetch("studies", "selectWallet", paramsPut)
101-
.then(() => {
102-
const msg = this.tr("Credit Account saved");
103-
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
104-
})
105-
.catch(err => {
106-
console.error(err);
107-
osparc.FlashMessenger.logAs(err.message, "ERROR");
108-
})
109-
.finally(() => {
110-
boxContent.setEnabled(true);
111-
this.__populateWallets();
112-
});
93+
this.__switchWallet(walletId);
11394
}
11495
});
11596
});
11697
},
11798

99+
__switchWallet: function(walletId) {
100+
const creditAccountLayout = this.getChildControl("credit-account-layout");
101+
creditAccountLayout.setEnabled(false);
102+
const paramsPut = {
103+
url: {
104+
studyId: this.__studyData["uuid"],
105+
walletId
106+
}
107+
};
108+
osparc.data.Resources.fetch("studies", "selectWallet", paramsPut)
109+
.then(() => {
110+
const msg = this.tr("Credit Account saved");
111+
osparc.FlashMessenger.getInstance().logAs(msg, "INFO");
112+
})
113+
.catch(err => {
114+
console.error(err);
115+
osparc.FlashMessenger.logAs(err.message, "ERROR");
116+
})
117+
.finally(() => {
118+
creditAccountLayout.setEnabled(true);
119+
this.__populateWallets();
120+
});
121+
},
122+
118123
__buildPricingUnitsGroup: function() {
119124
const pricingUnitsLayout = osparc.study.StudyOptions.createGroupBox(this.tr("Tiers"));
120125
const pricingUnits = new osparc.study.StudyPricingUnits(this.__studyData);

0 commit comments

Comments
 (0)