-
-
Save Nilanth/77821579f54bc9e7d0c4454410826084 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [progress, setProgress] = useState(0); | |
//Logic to show upload progress | |
const config = { | |
onUploadProgress: progressEvent => { | |
const percentCompleted = Math.round( (progressEvent.loaded * 100) / progressEvent.total ); | |
setProgress(percentCompleted); | |
} | |
}; | |
try { | |
const updatedData = axios.put('/upload/server', data, config); | |
return updatedData.response.data; | |
} cactch(error) { | |
//log error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment