aboutsummaryrefslogtreecommitdiff
path: root/src/services/CommentService.ts
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-05-10 15:17:45 -0400
committerIvan Chen <ivan@tagg.id>2021-05-10 16:50:42 -0400
commit4f37038df45ee1aea6d42933ffa79f70a0a426d2 (patch)
tree063344d92d9d90b8f2b751bf64bedb73fe932e90 /src/services/CommentService.ts
parentf9cee23e41c76bf6a5d607ba0d772b65aab7c3f0 (diff)
added basic type, added like/unlike handler
Diffstat (limited to 'src/services/CommentService.ts')
-rw-r--r--src/services/CommentService.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/services/CommentService.ts b/src/services/CommentService.ts
index 2faaa8db..6f054c72 100644
--- a/src/services/CommentService.ts
+++ b/src/services/CommentService.ts
@@ -2,7 +2,7 @@ import AsyncStorage from '@react-native-community/async-storage';
import {Alert} from 'react-native';
import {COMMENTS_ENDPOINT, COMMENT_THREAD_ENDPOINT} from '../constants';
import {ERROR_FAILED_TO_COMMENT} from '../constants/strings';
-import {CommentType} from '../types';
+import {CommentBaseType, CommentType} from '../types';
export const getComments = async (
objectId: string,
@@ -116,3 +116,19 @@ export const deleteComment = async (id: string, isThread: boolean) => {
return false;
}
};
+
+/**
+ * If `user_reaction` is undefined, we like the comment, if `user_reaction`
+ * is defined, we unlike the comment.
+ *
+ * @param comment the comment object
+ * @returns
+ */
+export const handleLikeUnlikeComment = async (comment: CommentBaseType) => {
+ try {
+ return undefined;
+ } catch (error) {
+ console.log('Unable to like/unlike a comment');
+ console.error(error);
+ }
+};