0

i need help in sending data from frontend to backend Now i use this code: in this example when we attach video and want to upload them, all of them start to uploading and send to backend and its reduce the speed

const handlePatchSeasons = async (ID) => {
    seasonsEpisodes.forEach(async (item) => {
      try {
        const seasonResponse = await patchAppendSeasonToSeries({
          series_id: ID,
          title: item.title,
        });
        if (seasonResponse.status === 200) {
          item.episodes.forEach(async (e) => {
            try {
              // uploading video
              if (e.file) {
                await uploadingVideos(e, seasonResponse.data.data);
              }
              // upload episode Without video
              else {
                const { status, data } =
                  await patchAppendEpisodeToSeasonOfSeries({
                    season_id: seasonResponse.data.data.id,
                    title: e.title,
                    imdb_id: e.imdb_id,
                    content_url: "",
                  });
                if (status === 200) {
                  console.log("OK");
                }
              }
            } catch (error) {
              console.error(error);
            }
          });
        }
      } catch (err) {
        console.error(err);
      }
    });
  };

Now i want a way to send videos One by One, means: when first video uploaded then start the second one ... how can i do it?

Peter
  • 80
  • 7

0 Answers0