aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rw-r--r--src/services/MomentServices.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/services/MomentServices.ts b/src/services/MomentServices.ts
index 735f2ed2..7bad6d4c 100644
--- a/src/services/MomentServices.ts
+++ b/src/services/MomentServices.ts
@@ -14,9 +14,9 @@ import {checkImageUploadStatus} from '../utils';
export const getMomentComments = async (
momentId: string,
callback: Function,
- token: string,
) => {
try {
+ const token = await AsyncStorage.getItem('token');
const response = await fetch(COMMENTS_ENDPOINT + '?moment_id=' + momentId, {
method: 'GET',
headers: {
@@ -35,14 +35,13 @@ export const getMomentComments = async (
}
};
-//Post a comment on a moment
export const postMomentComment = async (
commenter: string,
comment: string,
momentId: string,
- token: string,
) => {
try {
+ const token = await AsyncStorage.getItem('token');
const request = new FormData();
request.append('moment_id', momentId);
request.append('commenter', commenter);
@@ -60,7 +59,7 @@ export const postMomentComment = async (
return await response.json();
} catch (error) {
Alert.alert(ERROR_FAILED_TO_COMMENT);
- return {};
+ return undefined;
}
};