aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShravya Ramesh <shravs1208@gmail.com>2021-06-09 17:00:11 -0700
committerShravya Ramesh <shravs1208@gmail.com>2021-06-09 17:00:11 -0700
commit576857b69ddf50afca16a345fb4f26997051681f (patch)
tree7e66760217cdf66d5c95a19d1eca7f79390588c4 /src
parent6fcfaa41f3a5ec6ec7bbd28d98be865b24cfc6ac (diff)
Handle navigation, error msg after editing
Diffstat (limited to 'src')
-rw-r--r--src/screens/profile/CaptionScreen.tsx21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/screens/profile/CaptionScreen.tsx b/src/screens/profile/CaptionScreen.tsx
index d4ba6b23..9e1b4674 100644
--- a/src/screens/profile/CaptionScreen.tsx
+++ b/src/screens/profile/CaptionScreen.tsx
@@ -21,7 +21,11 @@ import {SearchBackground} from '../../components';
import {CaptionScreenHeader} from '../../components/';
import TaggLoadingIndicator from '../../components/common/TaggLoadingIndicator';
import {TAGG_LIGHT_BLUE_2} from '../../constants';
-import {ERROR_UPLOAD, SUCCESS_PIC_UPLOAD} from '../../constants/strings';
+import {
+ ERROR_SOMETHING_WENT_WRONG_REFRESH,
+ ERROR_UPLOAD,
+ SUCCESS_PIC_UPLOAD,
+} from '../../constants/strings';
import {MainStackParams} from '../../routes';
import {patchMoment, postMoment, postMomentTags} from '../../services';
import {
@@ -89,15 +93,20 @@ const CaptionScreen: React.FC<CaptionScreenProps> = ({route, navigation}) => {
const handleFailed = () => {
setLoading(false);
setTimeout(() => {
- Alert.alert(moment ? 'Error editing moment' : ERROR_UPLOAD);
+ Alert.alert(moment ? ERROR_SOMETHING_WENT_WRONG_REFRESH : ERROR_UPLOAD);
}, 500);
};
const handleSuccess = () => {
setLoading(false);
- navigateToProfile();
- setTimeout(() => {
- Alert.alert(moment ? 'Successfully edited moment!' : SUCCESS_PIC_UPLOAD);
- }, 500);
+ if (moment) {
+ setLoading(false);
+ navigation.goBack();
+ } else {
+ navigateToProfile();
+ setTimeout(() => {
+ Alert.alert(SUCCESS_PIC_UPLOAD);
+ }, 500);
+ }
};
const formattedTags = () => {