import Api from '../../../Framework/Api';

export const lazyFetch = async (requestConfig, fallbackValue) => {
    try {
        return await Api.request(requestConfig);
    } catch (e) {
        // eslint-disable-next-line no-console
        console.error(e);
        if (typeof fallbackValue !== 'undefined') {
            return fallbackValue;
        }
        throw e;
    }
};
