我在React JS中使用React Tostify进行烤面包机处理Flash消息,现在我必须显示它工作正常 进度栏,用于上传文件。
问题
下面的代码可以正常工作,并且吐司正在更新,但是在第一次更新后就消失了。
输出
我要更新进度条,直到达到100%。
function storePMOrderVideo(videoData, orderId, folder, key) {
let toastId = null;
return dispatch => {
return orderService.storePMOrderVideo(videoData, orderId, folder, key, (progress)=>{
if ( toastId === null ) {
toastId = toast('Upload in Progress'+progress, {
render: "Video Uploaded Done",
progress : progress,
type: toast.TYPE.INFO,
autoClose: false
});
} else {
toast.update(toastId, {
render: "Upload in Progress"+progress,
progress : progress,
type: toast.TYPE.INFO,
autoClose: false
});
}
}).then(
response => {
dispatch(success(response));
dispatch(alertActions.success(response.message))
toast.done(toast.id);
return response;
},
error => {
dispatch(failure(error));
}
)
}
function success(response) { return { type: adminConstants.STORE_PM_ORDER_VIDEO_SUCCESS, payload: response } }
function failure(error) { return { type: adminConstants.STORE_PM_ORDER_VIDEO_FAILURE, payload: error } }
}