Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c11dcb5

Browse files
fetch user subscriptions in app.tsx file
1 parent d0f42b0 commit c11dcb5

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

‎client/packages/lowcoder/src/app.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ import {
3131
ADMIN_AUTH_URL,
3232
PUBLIC_APP_EDITOR_URL,
3333
} from "constants/routesURL";
34-
import React, { useMemo } from "react";
34+
import React, { useEffect,useMemo } from "react";
3535
import { createRoot } from "react-dom/client";
3636
import { Helmet } from "react-helmet";
37-
import { connect, Provider } from "react-redux";
37+
import { connect, Provider,useDispatch,useSelector } from "react-redux";
3838
import { Redirect, Route, Router, Switch } from "react-router-dom";
3939
import type { AppState } from "redux/reducers";
40-
import { fetchConfigAction } from "redux/reduxActions/configActions";
40+
import { fetchConfigAction,fetchDeploymentIdAction } from "redux/reduxActions/configActions";
4141
import { fetchUserAction } from "redux/reduxActions/userActions";
4242
import { reduxStore } from "redux/store/store";
4343
import { developEnv } from "util/envUtils";
@@ -50,10 +50,10 @@ import { loadComps } from "comps";
5050
import { initApp } from "util/commonUtils";
5151
import { favicon } from "assets/images";
5252
import { hasQueryParam } from "util/urlUtils";
53-
import { isFetchUserFinished } from "redux/selectors/usersSelectors"; // getCurrentUser,
53+
import { getUser,isFetchUserFinished } from "redux/selectors/usersSelectors"; // getCurrentUser,
5454
import { getIsCommonSettingFetched } from "redux/selectors/commonSettingSelectors";
5555
import { SystemWarning } from "./components/SystemWarning";
56-
import { getBrandingConfig } from "./redux/selectors/configSelectors";
56+
import { getBrandingConfig,getDeploymentId } from "./redux/selectors/configSelectors";
5757
import { buildMaterialPreviewURL } from "./util/materialUtils";
5858
import GlobalInstances from 'components/GlobalInstances';
5959
// import posthog from 'posthog-js'
@@ -64,6 +64,7 @@ import { fetchBrandingSetting } from "./redux/reduxActions/enterpriseActions";
6464
import { EnterpriseProvider } from "./util/context/EnterpriseContext";
6565
import { SimpleSubscriptionContextProvider } from "./util/context/SimpleSubscriptionContext";
6666
import { getBrandingSetting } from "./redux/selectors/enterpriseSelectors";
67+
import { fetchSubscriptionsAction } from "./redux/reduxActions/subscriptionActions";
6768

6869
const LazyUserAuthComp = React.lazy(() => import("pages/userAuth"));
6970
const LazyInviteLanding = React.lazy(() => import("pages/common/inviteLanding"));
@@ -81,6 +82,22 @@ const Wrapper = React.memo((props: {
8182
language: string,
8283
fontFamily?: string
8384
}) => {
85+
const deploymentId = useSelector(getDeploymentId);
86+
const user = useSelector(getUser);
87+
const dispatch = useDispatch();
88+
89+
useEffect(() => {
90+
if (user.currentOrgId) {
91+
dispatch(fetchDeploymentIdAction());
92+
}
93+
}, [user.currentOrgId]);
94+
95+
useEffect(() => {
96+
if(Boolean(deploymentId)) {
97+
dispatch(fetchSubscriptionsAction())
98+
}
99+
}, [deploymentId]);
100+
84101
const theme = useMemo(() => {
85102
return {
86103
hashed: false,

‎client/packages/lowcoder/src/pages/ApplicationV2/index.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ import { selectIsLicenseActive } from "redux/selectors/enterpriseSelectors";
6464

6565
// adding App Editor, so we can show Apps inside the Admin Area
6666
import AppEditor from "../editor/AppEditor";
67-
import { fetchDeploymentIdAction } from "@lowcoder-ee/redux/reduxActions/configActions";
68-
import { getDeploymentId } from "@lowcoder-ee/redux/selectors/configSelectors";
6967
import {LoadingBarHideTrigger} from "@lowcoder-ee/util/hideLoading";
7068

7169
const TabLabel = styled.div`
@@ -95,30 +93,17 @@ export default function ApplicationHome() {
9593
const allFoldersCount = allFolders.length;
9694
const orgHomeId = "root";
9795
const subscriptions = useSelector(getSubscriptions);
98-
const deploymentId = useSelector(getDeploymentId);
9996

10097
const isOrgAdmin = org?.createdBy == user.id ? true : false;
10198
const isLicenseActive = useSelector(selectIsLicenseActive);
10299

103-
useEffect(() => {
104-
if (user.currentOrgId) {
105-
dispatch(fetchDeploymentIdAction());
106-
}
107-
}, [user.currentOrgId]);
108-
109100
useEffect(() => {
110101
// tricky check, will be called for anonymous user to redirect to login page
111102
if (user.isAnonymous) {
112103
dispatch(fetchHomeData({}));
113104
}
114105
}, [user.isAnonymous])
115106

116-
useEffect(() => {
117-
if(Boolean(deploymentId)) {
118-
dispatch(fetchSubscriptionsAction())
119-
}
120-
}, [deploymentId]);
121-
122107
const supportSubscription = useMemo(() => {
123108
return subscriptions.some(
124109
sub => sub.product === SubscriptionProductsEnum.SUPPORT && sub.status === 'active'

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /