mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-21 21:05:09 +00:00
22 lines
628 B
TypeScript
22 lines
628 B
TypeScript
import type { FC, PropsWithChildren } from 'react'
|
|
import { useEffect } from 'react'
|
|
import { useSession } from './auth-client'
|
|
import { useSessionInfo } from './sessionStorage'
|
|
|
|
export const AuthProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
const { data, isPending } = useSession()
|
|
const { updateSessionInfo } = useSessionInfo()
|
|
|
|
// biome-ignore lint/correctness/useExhaustiveDependencies: only re-run when data changes
|
|
useEffect(() => {
|
|
if (!isPending) {
|
|
updateSessionInfo({
|
|
session: data?.session,
|
|
user: data?.user,
|
|
})
|
|
}
|
|
}, [data, isPending])
|
|
|
|
return <>{children}</>
|
|
}
|