import RNFetchBlob from 'rn-fetch-blob'; import {VERSION_ENDPOINT} from '../constants'; export const loadImageFromURL = async (url: string) => { try { if (!url) { return undefined; } const response = await RNFetchBlob.config({ fileCache: false, appendExt: 'jpg', }).fetch('GET', url); const status = response.info().status; if (status === 200) { return response.path(); } else { return undefined; } } catch (error) { console.log(error); return undefined; } }; export const getLiveVersion = async () => { try { const response = await fetch(VERSION_ENDPOINT, {method: 'GET'}); return response.status === 200 ? await response.json() : undefined; } catch (error) { console.log(error); return undefined; } };