Client types
The browser client types exported by comark-content/client.
The types describing the browser-safe Content client and its options.
ContentFetch
The fetch signature the client uses for every request.
type ContentFetch = <T = unknown>(url: string, options?: Record<string, any>) => Promise<T>ContentClient
The browser client returned by createContentClient().
interface ContentClient {
get<Data = Record<string, any>>(path: string): Promise<ContentFile<Data> | null>
list<Data = Record<string, any>>(sources?: string[]): Promise<ContentListFile<Data>[]>
navigation(): Promise<NavigationItem[]>
}ContentClientOptions
Options for createContentClient().
interface ContentClientOptions {
baseURL?: string // default '' (same-origin)
basePath?: string // default '/api/content'
fetch?: ContentFetch
}ContentClientWithOptions
The client as a client plugin's setup sees it: ContentClient plus its resolved options.
interface ContentClientWithOptions extends ContentClient {
options: { baseURL: string; basePath: string; fetch: ContentFetch }
}