Add OpenBao API client, session context and connect screen
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5dbb78d1b
commit
de36c97f36
9 files changed
+438
-4
No files matched your search
@@ -0,0 +1,17 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
import type { BaoClient, TokenInfo } from './bao'
|
||||
|
||||
export interface Session {
|
||||
client: BaoClient | null
|
||||
tokenInfo: TokenInfo | null
|
||||
connect: (client: BaoClient, tokenInfo: TokenInfo) => void
|
||||
disconnect: () => void
|
||||
}
|
||||
|
||||
export const SessionContext = createContext<Session | null>(null)
|
||||
|
||||
export function useSession(): Session {
|
||||
const s = useContext(SessionContext)
|
||||
if (!s) throw new Error('useSession must be used inside SessionProvider')
|
||||
return s
|
||||
}
|
||||
Reference in new issue
Block a user