WeaverseClient class provides developers with a suite of methods to interact with Weaverse, manage caching strategies, and load theme-specific settings and pages.
Developers construct an instance with appropriate configurations, including environmental variables, storefront information, and more, and then inject the instance into the app's load context for global accessibility.
Refer to the Project Structure article for a detailed walkthrough on setting up.
string- The endpoint to which the fetch request is made.
FetchWithCacheOptions- Optional. Configurations for the fetch request, including caching strategies and additional request initializations.
Promise<T>- A promise that resolves with the fetched data of the generic type
Description: Fetches data from an external API, applying the specified caching strategy.
Refer to the Data Fetching and Caching to learn more.
AllCacheOptions- Optional. The caching strategy to use when fetching theme settings.
Promise<any>- A promise that resolves with the theme settings data.
Description: Loads the theme settings, applying caching if not in design mode.
Refer to the Global Theme Settings to learn more.
LoadPageParams- Optional. Parameters for loading the page, including caching strategy and other request-specific data.
Promise<WeaverseLoaderData | null>- A promise that resolves with the data necessary for rendering a page or
nullin case of an error.
Description: Loads the data for a specific page, including configurations and content.
Refer to the Rendering a Weaverse Page to learn more.