Skip to content

Commit

Permalink
prevent nextFormStep unless credential fully set up (#2599)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx authored Sep 29, 2024
1 parent e159b2e commit 15283b3
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,35 +143,10 @@ export default function AddConnector({
const { liveGDriveCredential } = useGoogleDriveCredentials();
const { liveGmailCredential } = useGmailCredentials();

const {
data: appCredentialData,
isLoading: isAppCredentialLoading,
error: isAppCredentialError,
} = useSWR<{ client_id: string }, FetchError>(
"/api/manage/admin/connector/google-drive/app-credential",
errorHandlingFetcher
);
const {
data: serviceAccountKeyData,
isLoading: isServiceAccountKeyLoading,
error: isServiceAccountKeyError,
} = useSWR<{ service_account_email: string }, FetchError>(
"/api/manage/admin/connector/google-drive/service-account-key",
errorHandlingFetcher
);

// Check if credential is activated
const credentialActivated =
(connector === "google_drive" &&
(liveGDriveCredential ||
appCredentialData ||
serviceAccountKeyData ||
currentCredential)) ||
(connector === "gmail" &&
(liveGmailCredential ||
appCredentialData ||
serviceAccountKeyData ||
currentCredential)) ||
(connector === "google_drive" && liveGDriveCredential) ||
(connector === "gmail" && liveGmailCredential) ||
currentCredential;

// Check if there are no credentials
Expand Down

0 comments on commit 15283b3

Please sign in to comment.