Auth timeout (#1263)
This commit is contained in:
parent
ddb32a3614
commit
3283f55e7e
|
@ -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>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue