fix: handle HTTP redirects in event stream and improve JWT expiration handling

This commit is contained in:
Mabe
2026-06-21 17:42:16 +02:00
parent 39e2aaecf2
commit 98219a6a53
2 changed files with 31 additions and 1 deletions
+13
View File
@@ -263,6 +263,13 @@ function App() {
[token],
)
useEffect(() => {
if (token && isJwtExpired(token)) {
clearLocalToken()
setToken(null)
}
}, [token])
async function login() {
clearLocalToken()
try {
@@ -298,6 +305,12 @@ function App() {
async function submitMessage() {
if (!input.trim() || !token) return
if (isJwtExpired(token)) {
clearLocalToken()
setToken(null)
setError('Session expired, please log in again.')
return
}
const userMessage: Message = { role: 'user', content: input.trim() }
const messageBatch = [...messages, userMessage]