@tapis/tapisui-api
Version:
Typescript library for making api calls with react query
19 lines (18 loc) • 521 B
JavaScript
const apiGenerator = (module, api, basePath, jwt) => {
const headers = {
'x-tapis-tracking-id': `tapisui`,
};
if (jwt) {
headers['X-Tapis-Token'] = jwt;
}
// Generate a configuration object for the module with the
// API URL and the authorization header
const configuration = new module.Configuration({
basePath,
headers,
});
// Create an instance of the API
const result = new api(configuration);
return result;
};
export default apiGenerator;