fix user refresh

This commit is contained in:
john 2025-05-20 23:43:43 +02:00
parent 0b2a64e449
commit cc3d138fd3
6 changed files with 6 additions and 13 deletions

View file

@ -5,7 +5,7 @@ import { AuthService } from './app/auth/authService.ts'
// Starts a loop that pings the server to keep the session alive, while also getting any updates on the user profile
export function useRefreshSessionLoop(authService: AuthService) {
const user = useUser()
const userId = user?.userId ?? null
const userId = user?.id ?? null
useEffect(() => {
if (userId == null) {
@ -17,6 +17,7 @@ export function useRefreshSessionLoop(authService: AuthService) {
timeouts.push(
setTimeout(async function refreshUser() {
await authService.refreshUser(userId)
timeouts.push(setTimeout(refreshUser, 60_000))
}),
)