From 29830ee54f801811282e147b3670de85a13c6042 Mon Sep 17 00:00:00 2001 From: u-e Date: Thu, 14 Feb 2019 11:41:58 +0300 Subject: [PATCH] updated for remove reply --- .../editor/container/editorContainer.js | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index 80196b09e..9d75d9126 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -118,7 +118,7 @@ class EditorContainer extends Component { }); } else { await getDraftPost(username) - .then((result) => { + .then(result => { this.setState({ draftPost: { body: result.body, title: result.title, tags: result.tags.split(',') }, }); @@ -127,13 +127,11 @@ class EditorContainer extends Component { // alert(error); }); } - - }; _getPurePost = (author, permlink) => { getPurePost(author, permlink) - .then((result) => { + .then(result => { if (result) { this.setState(prevState => ({ draftPost: { @@ -146,7 +144,7 @@ class EditorContainer extends Component { .catch(() => {}); }; - _handleRoutingAction = (routingAction) => { + _handleRoutingAction = routingAction => { this.setState({ isCameraOrPickerOpen: true }); if (routingAction === 'camera') { @@ -162,10 +160,10 @@ class EditorContainer extends Component { ImagePicker.openPicker({ includeBase64: true, }) - .then((image) => { + .then(image => { this._handleMediaOnSelected(image); }) - .catch((e) => { + .catch(e => { this._handleMediaOnSelectFailure(e); }); }; @@ -174,15 +172,15 @@ class EditorContainer extends Component { ImagePicker.openCamera({ includeBase64: true, }) - .then((image) => { + .then(image => { this._handleMediaOnSelected(image); }) - .catch((e) => { + .catch(e => { this._handleMediaOnSelectFailure(e); }); }; - _handleMediaOnSelected = (media) => { + _handleMediaOnSelected = media => { this.setState({ isCameraOrPickerOpen: false, isUploading: true }, () => { this._uploadImage(media); }); @@ -194,7 +192,7 @@ class EditorContainer extends Component { // const data = new Buffer(media.data, 'base64'); }; - _uploadImage = (media) => { + _uploadImage = media => { const { intl } = this.props; const file = { @@ -205,12 +203,12 @@ class EditorContainer extends Component { }; uploadImage(file) - .then((res) => { + .then(res => { if (res.data && res.data.url) { this.setState({ uploadedImage: res.data, isUploading: false }); } }) - .catch((error) => { + .catch(error => { Alert.alert( intl.formatMessage({ id: 'alert.fail', @@ -221,7 +219,7 @@ class EditorContainer extends Component { }); }; - _handleMediaOnSelectFailure = (error) => { + _handleMediaOnSelectFailure = error => { const { intl } = this.props; this.setState({ isCameraOrPickerOpen: false }); @@ -239,7 +237,7 @@ class EditorContainer extends Component { // Media select functions <- END -> - _saveDraftToDB = (fields) => { + _saveDraftToDB = fields => { const { isDraftSaved, draftId } = this.state; if (!isDraftSaved) { const { currentAccount } = this.props; @@ -259,7 +257,7 @@ class EditorContainer extends Component { }); }); } else { - addDraft(draftField).then((response) => { + addDraft(draftField).then(response => { this.setState({ isDraftSaved: true, draftId: response._id, @@ -273,7 +271,7 @@ class EditorContainer extends Component { } }; - _saveCurrentDraft = async (fields) => { + _saveCurrentDraft = async fields => { const { draftId, isReply } = this.state; if (!draftId) { @@ -293,10 +291,8 @@ class EditorContainer extends Component { } }; - _submitPost = async (fields) => { - const { - navigation, currentAccount, pinCode, intl, - } = this.props; + _submitPost = async fields => { + const { navigation, currentAccount, pinCode, intl } = this.props; if (currentAccount) { this.setState({ isPostSending: true }); @@ -355,13 +351,13 @@ class EditorContainer extends Component { setDraftPost({ title: '', body: '', tags: [] }, currentAccount.name); }) - .catch((error) => { + .catch(error => { this._handleSubmitFailure(error); }); } }; - _submitReply = async (fields) => { + _submitReply = async fields => { const { currentAccount, pinCode } = this.props; if (currentAccount) { @@ -390,14 +386,15 @@ class EditorContainer extends Component { ) .then(() => { this._handleSubmitSuccess(); + AsyncStorage.setItem('temp-reply', ""); }) - .catch((error) => { + .catch(error => { this._handleSubmitFailure(error); }); } }; - _submitEdit = async (fields) => { + _submitEdit = async fields => { const { currentAccount, pinCode } = this.props; const { post } = this.state; if (currentAccount) { @@ -435,13 +432,13 @@ class EditorContainer extends Component { .then(() => { this._handleSubmitSuccess(); }) - .catch((error) => { + .catch(error => { this._handleSubmitFailure(error); }); } }; - _handleSubmitFailure = (error) => { + _handleSubmitFailure = error => { const { intl } = this.props; Alert.alert( @@ -469,7 +466,7 @@ class EditorContainer extends Component { } }; - _handleSubmit = (form) => { + _handleSubmit = form => { const { isReply, isEdit } = this.state; if (isReply && !isEdit) {