diff options
| author | Ivan Chen <ivan@thetaggid.com> | 2021-01-22 19:03:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-22 19:03:25 -0500 |
| commit | 9921e80e60cb24d0fc7b99123a8b146c6e7d14ff (patch) | |
| tree | 68bebad4541397773ea810faff56a713d7fbdc6f /src/services | |
| parent | a37713192396304e5404ae5855d8fa79b7438921 (diff) | |
| parent | 3b1d14ba252325ee56f490c2d2318d3f4ef5897a (diff) | |
Merge pull request #199 from IvanIFChen/tma570-revamp-comments-keyboard-2
[TMA-570] Revamp Comments Keyboard
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/MomentServices.ts | 7 |
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; } }; |
