Deleted useless request.

This commit is contained in:
Tatiana Lopaeva 2024-08-06 10:12:27 +03:00
parent 4bc417422e
commit 50f593032b
14 changed files with 56 additions and 63 deletions

View File

@ -421,9 +421,11 @@ export default inject(
clientLoadingStore,
userStore,
settingsStore,
currentTariffStatusStore,
}) => {
const { isCommunity, isPaymentPageAvailable, currentDeviceType } =
authStore;
const { isPaymentPageAvailable, currentDeviceType } = authStore;
const { isCommunity } = currentTariffStatusStore;
const { showText, currentColorScheme } = settingsStore;
const {

View File

@ -74,16 +74,11 @@ const PrivateRouteWrapper = ({
export default inject<TStore>(
({ authStore, settingsStore, userStore, currentTariffStatusStore }) => {
const {
isAuthenticated,
isLoaded,
isAdmin,
const { isAuthenticated, isLoaded, isAdmin, isLogout } = authStore;
const { isNotPaidPeriod, isCommunity, isEnterprise } =
currentTariffStatusStore;
isLogout,
isCommunity,
isEnterprise,
} = authStore;
const { isNotPaidPeriod } = currentTariffStatusStore;
const { user } = userStore;
const {

View File

@ -109,10 +109,9 @@ const BenefitsContainer = ({ isTrial, isEnterprise }) => {
};
export default inject(
({ authStore, currentQuotaStore, paymentQuotasStore }) => {
const { isEnterprise } = authStore;
({ currentTariffStatusStore, currentQuotaStore, paymentQuotasStore }) => {
const { portalPaymentQuotasFeatures } = paymentQuotasStore;
const { isEnterprise } = currentTariffStatusStore;
const { isTrial } = currentQuotaStore;
return {

View File

@ -149,9 +149,11 @@ const ContactContainer = (props) => {
);
};
export default inject(({ authStore, settingsStore, paymentStore }) => {
const { isCommunity } = authStore;
const { helpUrl, salesEmail } = paymentStore;
const { theme } = settingsStore;
return { helpUrl, salesEmail, theme, isCommunity };
})(observer(ContactContainer));
export default inject(
({ currentTariffStatusStore, settingsStore, paymentStore }) => {
const { isCommunity } = currentTariffStatusStore;
const { helpUrl, salesEmail } = paymentStore;
const { theme } = settingsStore;
return { helpUrl, salesEmail, theme, isCommunity };
},
)(observer(ContactContainer));

View File

@ -134,11 +134,7 @@ export default inject(
currentQuotaStore,
currentTariffStatusStore,
}) => {
const {
isPaymentPageAvailable,
isEnterprise,
} = authStore;
const { isPaymentPageAvailable } = authStore;
const { isFreeTariff, isNonProfit, isTrial } = currentQuotaStore;
const {
isGracePeriod,
@ -146,6 +142,7 @@ export default inject(
isLicenseDateExpired,
paymentDate,
trialDaysLeft,
isEnterprise,
} = currentTariffStatusStore;
const { standalone } = settingsStore;

View File

@ -346,8 +346,8 @@ export default inject(
currentTariffStatusStore,
}) => {
const { isLoadedArticleBody, setIsLoadedArticleBody } = common;
const { isCommunity } = authStore;
const { isNotPaidPeriod } = currentTariffStatusStore;
const { isNotPaidPeriod, isCommunity } = currentTariffStatusStore;
const { user } = userStore;
const { isOwner } = user;
const {

View File

@ -83,6 +83,7 @@ class ProfileActionsStore {
pluginStore,
userStore,
settingsStore,
currentTariffStatusStore,
) {
this.authStore = authStore;
this.filesStore = filesStore;
@ -92,6 +93,7 @@ class ProfileActionsStore {
this.pluginStore = pluginStore;
this.userStore = userStore;
this.settingsStore = settingsStore;
this.currentTariffStatusStore = currentTariffStatusStore;
this.isShowLiveChat = this.getStateLiveChat();
@ -248,7 +250,7 @@ class ProfileActionsStore {
limitedAccessSpace,
} = this.settingsStore;
const isAdmin = this.authStore.isAdmin;
const isCommunity = this.authStore.isCommunity;
const isCommunity = this.currentTariffStatusStore.isCommunity;
// const { isOwner } = this.userStore.user;
// const settingsModule = modules.find((module) => module.id === "settings");

View File

@ -257,6 +257,7 @@ const profileActionsStore = new ProfileActionsStore(
pluginStore,
userStore,
settingsStore,
currentTariffStatusStore,
);
peopleStore.profileActionsStore = profileActionsStore;

View File

@ -57,10 +57,12 @@ let isPaymentPageUnavailable = true;
let isBonusPageUnavailable = true;
const App = observer(() => {
const { authStore, userStore, settingsStore } = useStore();
const { authStore, userStore, settingsStore, currentTariffStatusStore } =
useStore();
const location = useLocation();
const { init, isCommunity, isLoaded } = authStore;
const { init, isLoaded } = authStore;
const { isCommunity } = currentTariffStatusStore;
const { setTheme, limitedAccessSpace, timezone } = settingsStore;
window.timezone = timezone;

View File

@ -52,9 +52,9 @@ const ArticleBodyContent = () => {
const { t } = useTranslation(["Settings", "Common"]);
const { settingsStore, authStore } = useStore();
const { settingsStore, currentTariffStatusStore } = useStore();
const { isCommunity } = authStore;
const { isCommunity } = currentTariffStatusStore;
const { toggleArticleOpen, setIsBurgerLoading, currentColorScheme } =
settingsStore;

View File

@ -37,10 +37,12 @@ const {
userStore,
bannerStore,
settingsStore,
currentTariffStatusStore,
}: {
userStore: UserStore;
bannerStore: BannerStore;
authStore: any;
currentTariffStatusStore: any;
settingsStore: SettingsStore;
} = store;
@ -49,6 +51,7 @@ export class RootStore {
userStore = userStore;
bannerStore = bannerStore;
settingsStore = settingsStore;
currentTariffStatusStore = currentTariffStatusStore;
spacesStore = new SpacesStore(this.settingsStore);
}

View File

@ -37,6 +37,8 @@ export type TPortalTariff = {
customerId: string;
portalStatus?: number;
quotas: TQuotas[];
enterprise: boolean;
openSource: boolean;
};
export type TPaymentFeature = {

View File

@ -158,7 +158,7 @@ class AuthStore {
updateTariff = async () => {
this.setIsUpdatingTariff(true);
await this.getTenantExtra();
await this.getPaymentInfo();
await this.currentTariffStatusStore?.setPayerInfo();
this.setIsUpdatingTariff(false);
@ -189,7 +189,7 @@ class AuthStore {
requests.push(
this.userStore?.init(i18n, this.settingsStore.culture).then(() => {
if (!isPortalRestore) {
this.getTenantExtra();
this.getPaymentInfo();
}
}),
);
@ -227,28 +227,17 @@ class AuthStore {
});
};
get isEnterprise() {
this.currentTariffStatusStore?.setIsEnterprise(
this.tenantExtra?.enterprise || false,
);
return this.tenantExtra?.enterprise;
}
// fetchTenantExtra = (refresh: boolean) => {
// return getPortalTenantExtra(refresh).then((result) => {
// if (!result) return;
get isCommunity() {
return this.tenantExtra?.opensource;
}
// const { tariff, quota, ...tenantExtra } = result;
fetchTenantExtra = (refresh: boolean) => {
return getPortalTenantExtra(refresh).then((result) => {
if (!result) return;
// this.tenantExtra = tenantExtra;
// });
// };
const { tariff, quota, ...tenantExtra } = result;
this.tenantExtra = tenantExtra;
});
};
getTenantExtra = async () => {
getPaymentInfo = async () => {
let refresh = false;
if (window.location.search === "?complete=true") {
@ -262,10 +251,7 @@ class AuthStore {
request.push(this.currentTariffStatusStore?.fetchPortalTariff(refresh));
if (!user) {
request.push(
this.currentQuotaStore?.fetchPortalQuota(refresh),
this.fetchTenantExtra(refresh),
);
request.push(this.currentQuotaStore?.fetchPortalQuota(refresh));
}
await Promise.all(request);

View File

@ -46,8 +46,6 @@ class CurrentTariffStatusStore {
language: string = "en";
isEnterprise: boolean = false;
constructor() {
makeAutoObservable(this);
}
@ -56,14 +54,18 @@ class CurrentTariffStatusStore {
this.language = language;
};
setIsEnterprise = (isEnterprise: boolean) => {
this.isEnterprise = isEnterprise;
};
setIsLoaded = (isLoaded: boolean) => {
this.isLoaded = isLoaded;
};
get isEnterprise() {
return this.portalTariffStatus?.enterprise;
}
get isCommunity() {
return this.portalTariffStatus?.openSource;
}
get isGracePeriod() {
return this.portalTariffStatus?.state === TariffState.Delay;
}