UNPKG

@amityco/ts-sdk-react-native

Version:

Amity Social Cloud Typescript SDK

18 lines (15 loc) 537 B
export const convertToInternalComment = (commentPayload: Amity.CommentPayload) => { const { comments } = commentPayload; return { ...commentPayload, comments: comments.map(comment => { if (comment.hasOwnProperty('myReactions')) return comment; // Sometimes `myReactions` field will not come with BE response because that field is empty // We need to put it with an empty array manually to make it show up in client side return { myReactions: [], ...comment, }; }), }; };