I'm executing a photo upload using the fetch API and I keep receiving Type Error Network Request Error
. I receive the same error on the emulator and a device. I'm using react-native-image-crop-picker as the source for the photo upload data. Any thoughts?
const pathToURLImageUpload = async (image: any, token: string) => {
const { path, filename, mime } = image;
const uri = path.replace("file://", "")
const file = {
uri,
type: mime,
name: filename
};
const body = new FormData()
body.append('file', file)
const config = {
method: 'POST',
headers: { 'Authorization': 'Bearer ' + token },
body
};
return await fetch(`${<API URL>}/user/photo`, config)
}