@amityco/ts-sdk-react-native 6.26.1 → 6.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commentRepository/observers/getComments/CommentPaginationController.d.ts.map +1 -1
- package/dist/commentRepository/utils/payload.d.ts +1 -1
- package/dist/commentRepository/utils/payload.d.ts.map +1 -1
- package/dist/index.cjs.js +15 -5
- package/dist/index.esm.js +15 -5
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
- package/src/commentRepository/observers/getComments/CommentPaginationController.ts +6 -1
- package/src/commentRepository/utils/payload.ts +16 -2
package/package.json
CHANGED
|
@@ -8,7 +8,12 @@ export class CommentPaginationController extends PaginationController<
|
|
|
8
8
|
> {
|
|
9
9
|
async getRequest(queryParams: Amity.CommentLiveCollection, token: string | undefined) {
|
|
10
10
|
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, includeDeleted, ...params } = queryParams;
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
const baseOptions = {
|
|
13
|
+
type: params.sortBy || queryParams.limit ? 'pagination' : undefined,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const options = token ? { ...baseOptions, token } : { ...baseOptions, limit };
|
|
12
17
|
|
|
13
18
|
const { data: queryResponse } = await this.http.get<Amity.CommentPayload & Amity.Pagination>(
|
|
14
19
|
`/api/v3/comments`,
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
export function prepareCommentPayload(
|
|
2
|
-
|
|
2
|
+
commentPayload: Amity.CommentPayload,
|
|
3
3
|
): Amity.ProcessedCommentPayload {
|
|
4
|
-
|
|
4
|
+
const { comments } = commentPayload;
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
...commentPayload,
|
|
8
|
+
comments: comments.map(comment => {
|
|
9
|
+
if (comment.hasOwnProperty('myReactions')) return comment;
|
|
10
|
+
|
|
11
|
+
// Sometimes `myReactions` field will not come with BE response because that field is empty
|
|
12
|
+
// We need to put it with an empty array manually to make it show up in client side
|
|
13
|
+
return {
|
|
14
|
+
myReactions: [],
|
|
15
|
+
...comment,
|
|
16
|
+
};
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
5
19
|
}
|