Auth timeout (#1263)

This commit is contained in:
matt korwel 2025-06-20 11:33:31 -07:00 committed by GitHub
parent ddb32a3614
commit 3283f55e7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -5,7 +5,7 @@
*/
import React, { useState, useEffect } from 'react';
import { Box, Text } from 'ink';
import { Box, Text, useInput } from 'ink';
import Spinner from 'ink-spinner';
import { Colors } from '../colors.js';
@ -18,11 +18,17 @@ export function AuthInProgress({
}: AuthInProgressProps): React.JSX.Element {
const [timedOut, setTimedOut] = useState(false);
useInput((_, key) => {
if (key.escape) {
onTimeout();
}
});
useEffect(() => {
const timer = setTimeout(() => {
setTimedOut(true);
onTimeout();
}, 30000);
}, 180000);
return () => clearTimeout(timer);
}, [onTimeout]);
@ -42,7 +48,7 @@ export function AuthInProgress({
) : (
<Box>
<Text>
<Spinner type="dots" /> Waiting for auth...
<Spinner type="dots" /> Waiting for auth... (Press ESC to cancel)
</Text>
</Box>
)}