diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index 126debcb7..6d7241413 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -464,9 +464,7 @@ const MarkdownEditorView = ({ animationType="slide" style={styles.modalStyle} > - + { - dispatch( - toastNotification( + favoriteAction(username) + .then(() => { + dispatch( + toastNotification( + intl.formatMessage({ + id: isFavorite ? 'alert.success_unfavorite' : 'alert.success_favorite', + }), + ), + ); + this.setState({ isFavorite: !isFavorite, isProfileLoading: false }); + }) + .catch((error) => { + console.warn('Failed to perform favorite action'); + Alert.alert( intl.formatMessage({ - id: isFavorite ? 'alert.success_unfavorite' : 'alert.success_favorite', + id: 'alert.fail', }), - ), - ); - this.setState({ isFavorite: !isFavorite, isProfileLoading: false }); - }) - .catch((error)=>{ - console.warn("Failed to perform favorite action") - Alert.alert( - intl.formatMessage({ - id: 'alert.fail', - }), - error.message || error.toString() - ) - }); + error.message || error.toString(), + ); + }); }; _handleOnBackPress = () => { diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 254eef728..10a9369c5 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -43,7 +43,11 @@ import { } from '../../../realm/realm'; import { getUser, getPost } from '../../../providers/hive/dhive'; import { migrateToMasterKeyWithAccessToken, switchAccount } from '../../../providers/hive/auth'; -import { setPushToken, markActivityAsRead, markNotifications } from '../../../providers/ecency/ecency'; +import { + setPushToken, + markActivityAsRead, + markNotifications, +} from '../../../providers/ecency/ecency'; import { navigate } from '../../../navigation/service'; // Actions diff --git a/src/screens/drafts/container/draftsContainer.js b/src/screens/drafts/container/draftsContainer.js index 3e14d6a88..b45ef79af 100644 --- a/src/screens/drafts/container/draftsContainer.js +++ b/src/screens/drafts/container/draftsContainer.js @@ -101,7 +101,7 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => { _getSchedules(); }) .catch((error) => { - console.warn("Failed to move scheduled post to drafts") + console.warn('Failed to move scheduled post to drafts'); dispatch(toastNotification(intl.formatMessage({ id: 'alert.fail' }))); }); }; diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index bc5131246..e7f229f9c 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -945,7 +945,8 @@ class EditorContainer extends Component { data.jsonMeta, options, data.scheduleDate, - ) .then(() => { + ) + .then(() => { this.setState({ isPostSending: false, }); @@ -973,7 +974,7 @@ class EditorContainer extends Component { }, 3000); }) .catch((error) => { - console.warn("Failed to schedule post", error); + console.warn('Failed to schedule post', error); this.setState({ isPostSending: false, }); diff --git a/src/screens/notification/container/notificationContainer.js b/src/screens/notification/container/notificationContainer.js index 9ed179ed3..0e645561e 100644 --- a/src/screens/notification/container/notificationContainer.js +++ b/src/screens/notification/container/notificationContainer.js @@ -42,7 +42,7 @@ class NotificationContainer extends Component { if (!endOfNotification || !loadMore) { this.setState({ isNotificationRefreshing: true }); - getNotifications({ filter:type, since:since }) + getNotifications({ filter: type, since: since }) .then((res) => { console.log(res); const lastId = res.length > 0 ? [...res].pop().id : null; @@ -73,7 +73,7 @@ class NotificationContainer extends Component { let params; let key; markNotifications(data.id).then((result) => { - const {unread} = result; + const { unread } = result; dispatch(updateUnreadActivityCount(unread)); }); @@ -150,9 +150,7 @@ class NotificationContainer extends Component { (nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION && nextProps.username) || (nextProps.username !== username && nextProps.username) ) { - this.setState({ endOfNotification: false }, () => - this._getActivities(selectedFilter), - ); + this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter)); } } diff --git a/src/screens/register/registerContainer.js b/src/screens/register/registerContainer.js index 47fa4946a..c94dc2765 100644 --- a/src/screens/register/registerContainer.js +++ b/src/screens/register/registerContainer.js @@ -49,19 +49,17 @@ const RegisterContainer = ({ children, navigation }) => { }) .catch((err) => { if (get(err, 'response.status') === 500) { - Alert.alert(intl.formatMessage( - { id: 'alert.fail'}), - intl.formatMessage({ id: 'register.500_error' })); - } - else if (get(err, 'response.data.message')) { - Alert.alert(intl.formatMessage( - { id: 'alert.fail'}), - err.response.data.message); - } - else { - Alert.alert(intl.formatMessage( - { id: 'alert.fail'}), - intl.formatMessage({ id: 'alert.unknow_error' })); + Alert.alert( + intl.formatMessage({ id: 'alert.fail' }), + intl.formatMessage({ id: 'register.500_error' }), + ); + } else if (get(err, 'response.data.message')) { + Alert.alert(intl.formatMessage({ id: 'alert.fail' }), err.response.data.message); + } else { + Alert.alert( + intl.formatMessage({ id: 'alert.fail' }), + intl.formatMessage({ id: 'alert.unknow_error' }), + ); } setIsLoading(false); }); diff --git a/src/screens/searchResult/screen/tabs/best/container/postsResultsContainer.js b/src/screens/searchResult/screen/tabs/best/container/postsResultsContainer.js index 397d43656..c382cd3de 100644 --- a/src/screens/searchResult/screen/tabs/best/container/postsResultsContainer.js +++ b/src/screens/searchResult/screen/tabs/best/container/postsResultsContainer.js @@ -100,12 +100,12 @@ const PostsResultsContainer = ({ children, navigation, searchValue }) => { const _loadMore = (index, value) => { if (scrollId && searchValue) { search({ q: `${searchValue} type:post`, sort, scroll_id: scrollId }) - .then((res) => { - setData([...data, ...res.results]); - }) - .catch(()=>{ - console.warn("Search Failed"); - }) + .then((res) => { + setData([...data, ...res.results]); + }) + .catch(() => { + console.warn('Search Failed'); + }); } };