Как изменить file.status в компоненте ant Upload как «готово» после получения кода состояния 200 в моих реквизитах custoC#

Место общения программистов C#
Anonymous
Как изменить file.status в компоненте ant Upload как «готово» после получения кода состояния 200 в моих реквизитах custo

Сообщение Anonymous »


I am using ant design Upload component to upload files in my React application (TypeScript). I have endpoints to send the file data to my backend C#. after uploading it return status code 200 but the file status still "Uploading" how can I change to "done".

customRequest({ file, onSuccess, onError }) { const formData = new FormData(); formData.append('file', file); axios.post('http://localhost:6788/api/upload', formData, { headers: { 'Content-Type': 'multipart/form-data' } }) .then(response => { // Update the file status to "done" file.status = 'done'; if (onSuccess) { onSuccess(response.data, response); } }) .catch(error => { console.error('Error:', error); if (onError) { onError(error); } }); } in the line that I update the status to done it throw compile error Property 'status' does not exist on type 'File | RcFile'. Property 'status' does not exist on type 'File'.ts(2339)

Please provide the solution for this issue


Источник: https://stackoverflow.com/questions/781 ... ing-status

Вернуться в «C#»