index.ts 819 B

1234567891011121314151617181920212223242526272829
  1. import { ConnectionContext } from '@/providers/connection'
  2. import { DocumentContext } from '@/providers/document'
  3. import { SessionContext } from '@/providers/session'
  4. import { useContext } from 'react'
  5. export { useRouteSearch } from './routeSearch'
  6. /**
  7. * Get the connection to the Herda server.
  8. * This provides access to request options such as base URL, authentication etc.
  9. */
  10. export function useConnection() {
  11. return useContext(ConnectionContext)
  12. }
  13. /**
  14. * Get functions to modify the document, including setting the page title.
  15. */
  16. export function useDocument() {
  17. return useContext(DocumentContext)
  18. }
  19. /**
  20. * Get the user session, using the connection authentication.
  21. * This also provides functions to verify and manage the session.
  22. */
  23. export function useSession() {
  24. return useContext(SessionContext)
  25. }