prevent nextFormStep unless credential fully set up (#2599)

This commit is contained in:
pablodanswer 2024-09-29 15:47:45 -07:00 committed by GitHub
parent e159b2e947
commit 15283b3140
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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