@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
14 lines • 635 B
JavaScript
import { makeAbsoluteUrl } from './getSiteCollectionUrlFromLink';
/**
* To be used for any JS Fetch where you need the full absolute web url for the API
*
* @param sourceProps
* @returns
*/
export function getAbsoluteWebUrlFromSourceProps(sourceProps) {
const { absoluteWebUrl, webUrl, fetchAPI } = sourceProps;
// Added fetchAPI for when you use IMinSourceFetchProps (as in SourcePage component)
let useUrl = absoluteWebUrl ? absoluteWebUrl : webUrl ? webUrl : fetchAPI ? fetchAPI.split('/_api')[0] : '';
return makeAbsoluteUrl(useUrl);
}
//# sourceMappingURL=getAbssoluteWebUrlFromSourceProps.js.map