mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
Flush Fix
This commit is contained in:
parent
b77941ed30
commit
d7abb0c4a9
@ -91,12 +91,10 @@ class PostCreator extends React.PureComponent{
|
||||
const filter = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'video/mp4';
|
||||
if (!filter) {
|
||||
antd.message.error('Invalid File!');
|
||||
this.FlushPostState('error')
|
||||
}
|
||||
const maxsize = file.size / 1024 / 1024 < ycore.DevOptions.MaximunAPIPayload;
|
||||
if (!maxsize) {
|
||||
antd.message.error('Image must smaller than 99MB!');
|
||||
this.FlushPostState('error')
|
||||
}
|
||||
return filter && maxsize;
|
||||
}
|
||||
@ -116,20 +114,7 @@ class PostCreator extends React.PureComponent{
|
||||
this.setState({ toolbox_open: !this.state.toolbox_open })
|
||||
}
|
||||
|
||||
FlushPostState = (type) =>{
|
||||
switch (type) {
|
||||
case 'error':
|
||||
this.setState({
|
||||
posting_ok: false,
|
||||
posting: false,
|
||||
rawtext: '',
|
||||
fileURL: '',
|
||||
file: ''
|
||||
})
|
||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
||||
break;
|
||||
|
||||
default:
|
||||
FlushPostState(){
|
||||
this.setState({
|
||||
posting_ok: true,
|
||||
posting: false,
|
||||
@ -139,8 +124,7 @@ class PostCreator extends React.PureComponent{
|
||||
})
|
||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
||||
RefreshFeed()
|
||||
return
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
handlePublishPost = (e) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user