UNPKG

fastapi-rtk

Version:

A React component library for FastAPI in combination with FastAPI React Toolkit backend, built with Mantine, JsonForms, and Zustand.

59 lines (58 loc) 1.23 kB
export function useInfo(options: SafeContextOptions): InfoContext; export type SafeContextOptions = { /** * - Whether to throw an error if the context is not provided. */ throwOnError?: boolean; /** * - The default value to return if the context is not provided. */ defaultValue?: any; }; export type Info = { /** * - The icon associated with the API. */ icon: string; /** * - The level of the API. */ level: string; /** * - The name of the API. */ name: string; /** * - The path of the API. */ path: string; /** * - The permission name associated with the API. */ permission_name: string; /** * - The type of the API. */ type: string; }; export type InfoContext = { /** * - The base URL for the API. */ baseUrl: string; /** * - An array of Info objects or null if not available. */ info: Info[] | null; /** * - Indicates whether the info is currently loading. */ loading: boolean; /** * - An error object if the info request failed. */ error: { message: string; originalError: Error; } | null; };