feat(auth): wire AuthProvider around app providers and mirror token to sessionStorage

This commit is contained in:
Urban Modig
2025-10-13 00:19:42 +02:00
parent 47cef8e5a5
commit 03201cf133
2 changed files with 79 additions and 1 deletions

View File

@ -1,6 +1,7 @@
// src/app/providers.tsx
import { type PropsWithChildren, useState } from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { AuthProvider } from 'auth/AuthProvider'
export function AppProviders({ children }: PropsWithChildren) {
const [client] = useState(
@ -9,5 +10,9 @@ export function AppProviders({ children }: PropsWithChildren) {
defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 1 } },
})
)
return <QueryClientProvider client={client}>{children}</QueryClientProvider>
return (
<AuthProvider>
<QueryClientProvider client={client}>{children}</QueryClientProvider>
</AuthProvider>
)
}