import get from 'lodash/get';
import { getConf } from '../configuration';

export default function getImageUrl(path) {
    if (!path) {
        return '';
    }
    const appConf = getConf();
    const localResources = get(appConf, 'resources');
    if (localResources) {
        const localFile = get(localResources, path);
        if (localFile) {
            return localFile;
        }
    }

    const resourcePath = get(appConf.network, 'resourcesURL', '');
    return `${resourcePath}${path}`;
}
