Shared/Client: Store: Added separation of methods for standalone payment page.
This commit is contained in:
parent
4e1c1ad976
commit
89f31b8701
@ -231,12 +231,15 @@ class PaymentStore {
|
||||
};
|
||||
|
||||
standaloneBasicSettings = async (t: TTranslation) => {
|
||||
const { getTenantExtra } = authStore;
|
||||
if (!this.currentTariffStatusStore || !this.currentQuotaStore) return;
|
||||
|
||||
const { fetchPortalQuota } = this.currentQuotaStore;
|
||||
const { fetchPortalTariff } = this.currentTariffStatusStore;
|
||||
|
||||
this.setIsUpdatingBasicSettings(true);
|
||||
|
||||
try {
|
||||
await getTenantExtra();
|
||||
await Promise.all([fetchPortalTariff(), fetchPortalQuota()]);
|
||||
} catch (e) {
|
||||
toastr.error(t("Common:UnexpectedError"));
|
||||
|
||||
@ -247,7 +250,10 @@ class PaymentStore {
|
||||
};
|
||||
|
||||
standaloneInit = async (t: TTranslation) => {
|
||||
const { getTenantExtra } = authStore;
|
||||
if (!this.currentTariffStatusStore || !this.currentQuotaStore) return;
|
||||
|
||||
const { fetchPortalTariff } = this.currentTariffStatusStore;
|
||||
const { fetchPortalQuota } = this.currentQuotaStore;
|
||||
|
||||
if (this.isInitPaymentPage) {
|
||||
this.standaloneBasicSettings(t);
|
||||
@ -256,7 +262,11 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all([this.getSettingsPayment(), getTenantExtra()]);
|
||||
await Promise.all([
|
||||
this.getSettingsPayment(),
|
||||
fetchPortalTariff(),
|
||||
fetchPortalQuota(),
|
||||
]);
|
||||
} catch (error) {
|
||||
toastr.error(t("Common:UnexpectedError"));
|
||||
console.error(error);
|
||||
@ -317,14 +327,17 @@ class PaymentStore {
|
||||
|
||||
acceptPaymentsLicense = async (t: TTranslation) => {
|
||||
try {
|
||||
const { getTenantExtra } = authStore;
|
||||
|
||||
await acceptLicense();
|
||||
|
||||
toastr.success(t("ActivateLicenseActivated"));
|
||||
localStorage.removeItem("enterpriseAlertClose");
|
||||
|
||||
await getTenantExtra();
|
||||
if (!this.currentTariffStatusStore || !this.currentQuotaStore) return;
|
||||
|
||||
const { fetchPortalTariff } = this.currentTariffStatusStore;
|
||||
const { fetchPortalQuota } = this.currentQuotaStore;
|
||||
|
||||
await Promise.all([fetchPortalTariff(), fetchPortalQuota()]);
|
||||
} catch (e) {
|
||||
toastr.error(e as TData);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ class CurrentQuotasStore {
|
||||
});
|
||||
};
|
||||
|
||||
fetchPortalQuota = async (refresh: boolean) => {
|
||||
fetchPortalQuota = async (refresh?: boolean) => {
|
||||
return api.portal.getPortalQuota(refresh).then((res) => {
|
||||
this.setPortalQuotaValue(res);
|
||||
|
||||
|
@ -165,6 +165,8 @@ class CurrentTariffStatusStore {
|
||||
|
||||
fetchPortalTariff = async (refresh?: boolean) => {
|
||||
return api.portal.getPortalTariff(refresh).then((res) => {
|
||||
if (!res) return;
|
||||
|
||||
this.portalTariffStatus = res;
|
||||
this.setIsLoaded(true);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user