diff options
-rw-r--r-- | src/screens/profile/CaptionScreen.tsx | 21 |
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 = () => { |