progress on progress
This commit is contained in:
parent
4bfab41846
commit
1efcc57770
@ -77,20 +77,20 @@ class Main extends Component {
|
||||
data: formData,
|
||||
onUploadProgress: ({loaded, total}) => this.setState({uploadProgress: loaded/total})
|
||||
}
|
||||
).then(resp => resp.json()).then(json => {
|
||||
).then(({data}) => {
|
||||
this.setState({progress:false, uploadProgress: 1.0});
|
||||
if(json.reason){
|
||||
if(data.reason){
|
||||
this.setState({
|
||||
text: json.reason,
|
||||
text: data.reason,
|
||||
status: "failed",
|
||||
})
|
||||
} else {
|
||||
this.setState({
|
||||
text: json.success,
|
||||
text: data.success,
|
||||
status: "success",
|
||||
})
|
||||
if (json.redirect){
|
||||
window.open(json.redirect ,"_self")
|
||||
if (data.redirect){
|
||||
window.open(data.redirect ,"_self")
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -162,7 +162,7 @@ class Main extends Component {
|
||||
<div>
|
||||
<form id="form" action="/api/upload_files" class="container" onSubmit={(e) => this.onSubmit(e)}>
|
||||
<label>Zvolte soubory <input type="file" name="files" accept=".jpg,.png,.webp,.webm,.avi,.mkv,.mp4" multiple={true} onChange={(e)=> this.handleChangeFiles.bind(this)(e)}/></label>
|
||||
<button type="submit" class="btn btn-primary">Nahrát</button>
|
||||
<button type="submit" class="btn btn-primary">Nahrát</button> <b>progress: {this.state.uploadProgress}</b>
|
||||
</form>
|
||||
</div>}
|
||||
{this.state.page == "#payment" &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user