In my application after the user submits a form, I have access to an array of images and I need to call our backend to save all of their uploaded photos to our cloud server.
Our /upload api endpoint takes one image at a time. How do I create an api call for each image in this array and chain them to happen one after another? I was thinking I could somehow use reduce to do this, but I'm not 100% sure how to go about it.
Here's how I'm making an api call for single image upload:
    const api = "https://appName.herokuapp.com/upload";
    const uri = photos[0];
    const formData = new FormData();
    formData.append('image', {
      uri,
      name: `photo.jpg`,
      type: `image/jpg`,
    });
    const options = {
      method: 'POST',
      body: formData,
      headers: {
        Authorization:`Basic ${base64.encode(BACKEND_AUTHENTICATION_HEADER)}`,
        Accept: 'application/json',
        'Content-Type': 'multipart/form-data',
      },
    };
    fetch(api, options)
      .catch((e) => console.log(e))
      .then((response) => {
        console.log(response);
      })
 
     
    