Answer the question
In order to leave comments, you need to log in
How to make a GET request until the response from the POST request is returned?
I need to upload a file. As soon as I have selected the file, there is a POST request to the api and until the response is returned, I need to make a GET request to the api in order to get the progress of the uploaded file and display it. How can this be implemented? I tried using axios onUploadProgress, but then there are too many GET requests and the last one returns the wrong value.
Answer the question
In order to leave comments, you need to log in
How not to do it - but how to do it
1. You need to understand that the browser subsystem checks the status of the file delivery to the server and can tell you how much is left. Just take my word for it :) A get request can come in handy when you received a response from axios about a successful upload and make a get request to the server, saying "Is everything okay, is the file saved (maybe the place ran out at the time of copying - who knows who is there and where the spit ". And your scheme smacks of a ddos attack, if you look at the scale of a huge project%)
I tried using axios onUploadProgress, but then there are too many GET requests and the last one returns the wrong value.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question