()
| 43 | |
| 44 | useEffect(() => { |
| 45 | const authFlow = async () => { |
| 46 | const authType = settings.merged.selectedAuthType; |
| 47 | if (isAuthDialogOpen || !authType) { |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | try { |
| 52 | setIsAuthenticating(true); |
| 53 | await config.refreshAuth(authType); |
| 54 | console.log(`Authenticated via "${authType}".`); |
| 55 | } catch (e) { |
| 56 | setAuthError( |
| 57 | `Grok authentication failed - please check your API key: ${getErrorMessage(e)}`, |
| 58 | ); |
| 59 | openAuthDialog(); |
| 60 | } finally { |
| 61 | setIsAuthenticating(false); |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | void authFlow(); |
| 66 | }, [isAuthDialogOpen, settings, config, setAuthError, openAuthDialog]); |
no test coverage detected