mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
Auth timeout (#1263)
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text, useInput } from 'ink';
|
||||||
import Spinner from 'ink-spinner';
|
import Spinner from 'ink-spinner';
|
||||||
import { Colors } from '../colors.js';
|
import { Colors } from '../colors.js';
|
||||||
|
|
||||||
@@ -18,11 +18,17 @@ export function AuthInProgress({
|
|||||||
}: AuthInProgressProps): React.JSX.Element {
|
}: AuthInProgressProps): React.JSX.Element {
|
||||||
const [timedOut, setTimedOut] = useState(false);
|
const [timedOut, setTimedOut] = useState(false);
|
||||||
|
|
||||||
|
useInput((_, key) => {
|
||||||
|
if (key.escape) {
|
||||||
|
onTimeout();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setTimedOut(true);
|
setTimedOut(true);
|
||||||
onTimeout();
|
onTimeout();
|
||||||
}, 30000);
|
}, 180000);
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [onTimeout]);
|
}, [onTimeout]);
|
||||||
@@ -42,7 +48,7 @@ export function AuthInProgress({
|
|||||||
) : (
|
) : (
|
||||||
<Box>
|
<Box>
|
||||||
<Text>
|
<Text>
|
||||||
<Spinner type="dots" /> Waiting for auth...
|
<Spinner type="dots" /> Waiting for auth... (Press ESC to cancel)
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user