aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/services/MomentServices.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/services/MomentServices.ts b/src/services/MomentServices.ts
index 76f353ce..217b5857 100644
--- a/src/services/MomentServices.ts
+++ b/src/services/MomentServices.ts
@@ -1,7 +1,11 @@
import AsyncStorage from '@react-native-community/async-storage';
import {Alert} from 'react-native';
import {COMMENTS_ENDPOINT, MOMENTS_ENDPOINT} from '../constants';
-import {ERROR_FAILED_TO_COMMENT} from '../constants/strings';
+import {
+ ERROR_FAILED_TO_COMMENT,
+ ERROR_UPLOAD,
+ SUCCESS_PIC_UPLOAD,
+} from '../constants/strings';
import {MomentType} from '../types';
import {checkImageUploadStatus} from '../utils';
@@ -129,15 +133,15 @@ export const postMoment: (
});
let statusCode = response.status;
let data = await response.json();
- if (statusCode === 200 && checkImageUploadStatus(data['moments'])) {
- Alert.alert('The picture was uploaded successfully!');
- return data['profile_completion_stage'];
+ if (statusCode === 200 && checkImageUploadStatus(data.moments)) {
+ Alert.alert(SUCCESS_PIC_UPLOAD);
+ return data.profile_completion_stage;
} else {
- Alert.alert('An error occured while uploading. Please try again!');
+ Alert.alert(ERROR_UPLOAD);
}
} catch (err) {
console.log(err);
- Alert.alert('An error occured during authenticaion. Please login again!');
+ Alert.alert(ERROR_UPLOAD);
}
return undefined;
};