Skip to content

Commit

Permalink
Introduce DeploymentID for Subscription-Check
Browse files Browse the repository at this point in the history
  • Loading branch information
FalkWolsky committed Oct 26, 2024
1 parent 9b2334f commit 50b8eb9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions client/packages/lowcoder/src/redux/sagas/subscriptionSagas.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
import { call, put, select, takeLatest, all } from 'redux-saga/effects';
import { call, put, select, takeLatest, all, take } from 'redux-saga/effects';
import { fetchSubscriptionsAction } from 'redux/reduxActions/subscriptionActions';
import { searchCustomersSubscriptions, Subscription } from 'api/subscriptionApi';
import { fetchSubscriptionsSuccess, fetchSubscriptionsError } from 'redux/reduxActions/subscriptionActions';
import { LowcoderSearchCustomer } from 'api/subscriptionApi';
import { getUser, getCurrentUser } from 'redux/selectors/usersSelectors';
import { getDeploymentId } from "redux/selectors/configSelectors";
import { CurrentUser, User } from '@lowcoder-ee/constants/userConstants';
import { ReduxActionTypes } from '@lowcoder-ee/constants/reduxActionConstants';

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

try {

// wait for deploymentId to be available
yield take(ReduxActionTypes.FETCH_DEPLOYMENT_ID_SUCCESS);

const user: User = yield select(getUser);
const currentUser: CurrentUser = yield select(getCurrentUser);
const orgID = user.currentOrgId;
const domain = `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : ''}`;
const hostIdenticator = "lowcoder-test";

let hostIdenticator : string = yield select(getDeploymentId);

// Poll until deploymentId is available
while (!hostIdenticator) {
yield delay(100); // wait for 100ms
hostIdenticator = yield select(getDeploymentId);
}

const subscriptionSearchCustomer: LowcoderSearchCustomer = {
hostname: domain,
Expand Down

0 comments on commit 50b8eb9

Please sign in to comment.