progress on progress
This commit is contained in:
parent
4bfab41846
commit
1efcc57770
@ -77,20 +77,20 @@ class Main extends Component {
|
|||||||
data: formData,
|
data: formData,
|
||||||
onUploadProgress: ({loaded, total}) => this.setState({uploadProgress: loaded/total})
|
onUploadProgress: ({loaded, total}) => this.setState({uploadProgress: loaded/total})
|
||||||
}
|
}
|
||||||
).then(resp => resp.json()).then(json => {
|
).then(({data}) => {
|
||||||
this.setState({progress:false, uploadProgress: 1.0});
|
this.setState({progress:false, uploadProgress: 1.0});
|
||||||
if(json.reason){
|
if(data.reason){
|
||||||
this.setState({
|
this.setState({
|
||||||
text: json.reason,
|
text: data.reason,
|
||||||
status: "failed",
|
status: "failed",
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
text: json.success,
|
text: data.success,
|
||||||
status: "success",
|
status: "success",
|
||||||
})
|
})
|
||||||
if (json.redirect){
|
if (data.redirect){
|
||||||
window.open(json.redirect ,"_self")
|
window.open(data.redirect ,"_self")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -162,7 +162,7 @@ class Main extends Component {
|
|||||||
<div>
|
<div>
|
||||||
<form id="form" action="/api/upload_files" class="container" onSubmit={(e) => this.onSubmit(e)}>
|
<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>
|
<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>
|
</form>
|
||||||
</div>}
|
</div>}
|
||||||
{this.state.page == "#payment" &&
|
{this.state.page == "#payment" &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user