Source

externalCode/axiosApi.js

/**
 * @class
 * API Requests Hooks.
 * Instance name: axiosApi
  
 Axios is a library that the app uses to communicate with servers. You can modify the process by using AxiosApi.
 * @example
 * externalCodeSetup.axiosApi.METHOD_NAME
 */
export class AxiosApi {
	isClearCacheEnabled = false;
	achievementsParams = {};

	/**
	 * You can use this to enable clearing API cache for each request to ensure the server gives the latest data.
	 * @method
	 * @example
	 * externalCodeSetup.axiosApi.enableClearCache();
	 */
	enableClearCache = () => {
		this.isClearCacheEnabled = true;
	};

	/**
	 * Sets additional params used for fetching achievements that you can display in the achievements sections of your app.
	 * @method
	 * @param {Object} params
	 * @example <caption>Add an "orderby" parameter when fetching achievements API</caption>
	 *
	 * externalCodeSetup.axiosApi.setAchievementsParams({orderby: "date"});
	 */
	setAchievementsParams = params => (this.achievementsParams = params);
}