diff options
| author | matt korwel <[email protected]> | 2025-06-20 10:46:41 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-20 10:46:41 -0700 |
| commit | 7c8a1da8fe0856e7ebedcd543f82e20f09816222 (patch) | |
| tree | 28e597e682bad94d7799028d73449209df1866cb /packages/cli/src/ui/hooks/useAuthCommand.ts | |
| parent | 7c4af82da4ee4322daeb0ab78acafda4a73dc7e9 (diff) | |
Auth blocking (#1261)
Diffstat (limited to 'packages/cli/src/ui/hooks/useAuthCommand.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useAuthCommand.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useAuthCommand.ts b/packages/cli/src/ui/hooks/useAuthCommand.ts index 2c2b5f93..5cc67a07 100644 --- a/packages/cli/src/ui/hooks/useAuthCommand.ts +++ b/packages/cli/src/ui/hooks/useAuthCommand.ts @@ -31,6 +31,8 @@ export const useAuthCommand = ( setIsAuthDialogOpen(true); }, []); + const [isAuthenticating, setIsAuthenticating] = useState(false); + useEffect(() => { const authFlow = async () => { if (isAuthDialogOpen || !settings.merged.selectedAuthType) { @@ -38,6 +40,7 @@ export const useAuthCommand = ( } try { + setIsAuthenticating(true); await performAuthFlow( settings.merged.selectedAuthType as AuthType, config, @@ -51,6 +54,8 @@ Message: ${getErrorMessage(e)}` : `Failed to login. Message: ${getErrorMessage(e)}`; setAuthError(errorMessage); openAuthDialog(); + } finally { + setIsAuthenticating(false); } }; @@ -73,10 +78,16 @@ Message: ${getErrorMessage(e)}` // For now, we don't do anything on highlight. }, []); + const cancelAuthentication = useCallback(() => { + setIsAuthenticating(false); + }, []); + return { isAuthDialogOpen, openAuthDialog, handleAuthSelect, handleAuthHighlight, + isAuthenticating, + cancelAuthentication, }; }; |
