aboutsummaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-01-22 16:31:35 -0500
committerIvan Chen <ivan@tagg.id>2021-01-22 17:14:25 -0500
commit5f2159489e75a05dbe6bede792cb8a97971b824a (patch)
treea5188e0dc32d991b8e24dc9847ddeba93ee02a94 /src/services
parentd667654caf1aa4e5f4814fa927e835f13efc0650 (diff)
finished styling the input box
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;
}
};