Hygraph
Docs
View as Markdown

#Common props for all elements

export interface ExtensionPropsBase {
context: {
project: {
id: string;
name: string;
mgmtApi: string;
};
environment: {
id: string;
name: string;
endpoint: string;
// The app token for the current environment. Available after installation status is set to COMPLETED.
// Use as a Bearer token to authenticate requests to the Hygraph APIs.
authToken: string;
};
};
// Opens a separate dialog where you can load data from an external source or create your own UI
// See `OpenDialog` in "additional types"
openDialog: OpenDialog;
// open the asset picker (see the Asset type in your Content Api)
openAssetPicker: () => Promise<null | (Asset & Record<string, unknown>)>;
// Function to show Hygraph native toast.
// See `ShowToast` in "additional types"
showToast: ShowToast;
// Reload the current location, as if clicking the Refresh button
// Useful to update the UI after API calls that might change the form data.
reloadPage: () => void;
// Clear all search parameters
// Useful when app installations add search params that contain state
// that should be cleared afterwards, such as short-lived tokens.
clearSearchParams: () => void;
}