Skip to content

Commit f2160b2

Browse files
committed
frontend/tokens: refresh tokens every 5 seconds.
1 parent 71ddf49 commit f2160b2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frontend/src/pages/tokens.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ async function buildToken(userData: components["schemas"]["UserInfo"], tokenData
5050
return encoded;
5151
}
5252

53+
let fetchInterval = undefined;
5354
export function Tokens() {
5455
const { t } = useTranslation();
5556
const [tokens, setTokens] = useState([]);
@@ -108,6 +109,15 @@ export function Tokens() {
108109
}
109110

110111
fetchTokens();
112+
fetchInterval = setInterval(() => {
113+
fetchTokens();
114+
}, 5000);
115+
116+
return () => {
117+
if (fetchInterval) {
118+
clearInterval(fetchInterval);
119+
}
120+
}
111121
}, [t]);
112122

113123
// Creates a new authorization token on form submission

0 commit comments

Comments
 (0)