Skip to content

Commit 50b8eb9

Browse files
author
FalkWolsky
committed
Introduce DeploymentID for Subscription-Check
1 parent 9b2334f commit 50b8eb9

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

client/packages/lowcoder/src/redux/sagas/subscriptionSagas.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
1-
import { call, put, select, takeLatest, all } from 'redux-saga/effects';
1+
import { call, put, select, takeLatest, all, take } from 'redux-saga/effects';
22
import { fetchSubscriptionsAction } from 'redux/reduxActions/subscriptionActions';
33
import { searchCustomersSubscriptions, Subscription } from 'api/subscriptionApi';
44
import { fetchSubscriptionsSuccess, fetchSubscriptionsError } from 'redux/reduxActions/subscriptionActions';
55
import { LowcoderSearchCustomer } from 'api/subscriptionApi';
66
import { getUser, getCurrentUser } from 'redux/selectors/usersSelectors';
7+
import { getDeploymentId } from "redux/selectors/configSelectors";
78
import { CurrentUser, User } from '@lowcoder-ee/constants/userConstants';
89
import { ReduxActionTypes } from '@lowcoder-ee/constants/reduxActionConstants';
910

1011
function* fetchSubscriptionsSaga(action: ReturnType<typeof fetchSubscriptionsAction>) {
1112

1213
try {
14+
15+
// wait for deploymentId to be available
16+
yield take(ReduxActionTypes.FETCH_DEPLOYMENT_ID_SUCCESS);
17+
1318
const user: User = yield select(getUser);
1419
const currentUser: CurrentUser = yield select(getCurrentUser);
1520
const orgID = user.currentOrgId;
1621
const domain = `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`;
17-
const hostIdenticator = "lowcoder-test";
22+
23+
let hostIdenticator : string = yield select(getDeploymentId);
24+
25+
// Poll until deploymentId is available
26+
while (!hostIdenticator) {
27+
yield delay(100); // wait for 100ms
28+
hostIdenticator = yield select(getDeploymentId);
29+
}
1830

1931
const subscriptionSearchCustomer: LowcoderSearchCustomer = {
2032
hostname: domain,

0 commit comments

Comments
 (0)