mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-02 09:20:42 -07:00
feat(auth): Improve auth dialog error handling and messaging (#11320)
This commit is contained in:
@@ -73,7 +73,7 @@ describe('AuthDialog', () => {
|
||||
settings: LoadedSettings;
|
||||
setAuthState: (state: AuthState) => void;
|
||||
authError: string | null;
|
||||
onAuthError: (error: string) => void;
|
||||
onAuthError: (error: string | null) => void;
|
||||
};
|
||||
const originalEnv = { ...process.env };
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ interface AuthDialogProps {
|
||||
settings: LoadedSettings;
|
||||
setAuthState: (state: AuthState) => void;
|
||||
authError: string | null;
|
||||
onAuthError: (error: string) => void;
|
||||
onAuthError: (error: string | null) => void;
|
||||
}
|
||||
|
||||
export function AuthDialog({
|
||||
@@ -174,6 +174,9 @@ Logging in with Google... Please restart Gemini CLI to continue.
|
||||
items={items}
|
||||
initialIndex={initialAuthIndex}
|
||||
onSelect={handleAuthSelect}
|
||||
onHighlight={() => {
|
||||
onAuthError(null);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
{authError && (
|
||||
|
||||
@@ -33,9 +33,11 @@ export const useAuthCommand = (settings: LoadedSettings, config: Config) => {
|
||||
const [authError, setAuthError] = useState<string | null>(null);
|
||||
|
||||
const onAuthError = useCallback(
|
||||
(error: string) => {
|
||||
(error: string | null) => {
|
||||
setAuthError(error);
|
||||
setAuthState(AuthState.Updating);
|
||||
if (error) {
|
||||
setAuthState(AuthState.Updating);
|
||||
}
|
||||
},
|
||||
[setAuthError, setAuthState],
|
||||
);
|
||||
|
||||
@@ -23,7 +23,7 @@ export interface UIActions {
|
||||
scope: SettingScope,
|
||||
) => void;
|
||||
setAuthState: (state: AuthState) => void;
|
||||
onAuthError: (error: string) => void;
|
||||
onAuthError: (error: string | null) => void;
|
||||
handleEditorSelect: (
|
||||
editorType: EditorType | undefined,
|
||||
scope: SettingScope,
|
||||
|
||||
Reference in New Issue
Block a user