Skip to content

Commit b9d0ad6

Browse files
committed
fix(oauth): preflight reauthorization flows
1 parent cd08394 commit b9d0ad6

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

apps/sim/app/workspace/[workspaceId]/components/oauth-modal.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,25 @@ export function OAuthModal(props: OAuthModalProps) {
158158
setError(null)
159159

160160
try {
161+
const trimmedName = isConnect ? displayName.trim() : ''
161162
if (isConnect) {
162-
const trimmedName = displayName.trim()
163163
if (!trimmedName) {
164164
setError('Display name is required.')
165165
return
166166
}
167+
}
167168

168-
if (shouldPreflightOAuthProvider(providerId)) {
169-
const providerConfig = await requestJson(getOAuthProviderConfigContract, {
170-
query: { providerId },
171-
})
172-
if (!providerConfig.available) {
173-
setError(providerConfig.message)
174-
return
175-
}
169+
if (shouldPreflightOAuthProvider(providerId)) {
170+
const providerConfig = await requestJson(getOAuthProviderConfigContract, {
171+
query: { providerId },
172+
})
173+
if (!providerConfig.available) {
174+
setError(providerConfig.message)
175+
return
176176
}
177+
}
177178

179+
if (isConnect) {
178180
await createDraft.mutateAsync({
179181
workspaceId,
180182
providerId,

0 commit comments

Comments
 (0)