Skip to main content

GlobalDataResolver

globalDataResolver is designed to handle API calls required during the initial loading of the application. This function is executed by theme engine only once and it gets the applicationID and the fpi instance as arguments- and performs asynchronous calls to fetch essential data. The function calling is managed by the Skyfire Theme Engine; theme developers just need to define the function.

Example:

//helper/lib

export async function globalDataResolver({ fpi,applicationID }) {
return Promise.all([
fpi.configuration.fetchApplication(),
fpi.content.fetchLandingPage(),
fpi.content.fetchAppSeo(),
fpi.content?.fetchTags(),
fpi.auth?.fetchPlatformData({id:applicationID}),
]).catch(console.log);

}
// Export it from index.jsx file

import { globalDataResolver } from "./helper/lib";

return {
globalDataResolver

//other keys....
}