@amityco/ts-sdk 7.3.1-27a784d.0 → 7.3.1-3ec5a73.0
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/api/flagComment.d.ts +1 -1
- package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
- package/dist/index.cjs.js +8 -6
- package/dist/index.esm.js +8 -6
- package/dist/index.umd.js +1 -1
- package/dist/postRepository/api/flagPost.d.ts +1 -1
- package/dist/postRepository/api/flagPost.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/commentRepository/api/flagComment.ts +8 -6
- package/src/postRepository/api/flagPost.ts +8 -6
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* @category Post API
|
|
12
12
|
* @async
|
|
13
13
|
* */
|
|
14
|
-
export declare const flagPost: (postId: Amity.Post['postId'], reason
|
|
14
|
+
export declare const flagPost: (postId: Amity.Post['postId'], reason?: Amity.ContentFlagReason) => Promise<boolean>;
|
|
15
15
|
//# sourceMappingURL=flagPost.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,QAAQ,WACX,MAAM,IAAI,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"flagPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/api/flagPost.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;KAYK;AACL,eAAO,MAAM,QAAQ,WACX,MAAM,IAAI,CAAC,QAAQ,CAAC,WACnB,MAAM,iBAAiB,KAC/B,QAAQ,OAAO,CA2BjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -22,18 +22,20 @@ import { ContentFlagReasonEnum } from '~/@types';
|
|
|
22
22
|
* */
|
|
23
23
|
export const flagComment = async (
|
|
24
24
|
commentId: Amity.Comment['commentId'],
|
|
25
|
-
reason
|
|
25
|
+
reason?: Amity.ContentFlagReason,
|
|
26
26
|
): Promise<boolean> => {
|
|
27
27
|
const client = getActiveClient();
|
|
28
28
|
client.log('comment/flagComment', commentId);
|
|
29
29
|
|
|
30
|
-
const isPredefinedReason =
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const isPredefinedReason =
|
|
31
|
+
reason &&
|
|
32
|
+
Object.entries(ContentFlagReasonEnum).some(
|
|
33
|
+
([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
|
|
34
|
+
);
|
|
33
35
|
|
|
34
36
|
const body = {
|
|
35
|
-
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
36
|
-
detail: isPredefinedReason ?
|
|
37
|
+
reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const { data: payload } = await client.http.post<Amity.CommentPayload>(
|
|
@@ -22,18 +22,20 @@ import { ContentFlagReasonEnum } from '~/@types';
|
|
|
22
22
|
* */
|
|
23
23
|
export const flagPost = async (
|
|
24
24
|
postId: Amity.Post['postId'],
|
|
25
|
-
reason
|
|
25
|
+
reason?: Amity.ContentFlagReason,
|
|
26
26
|
): Promise<boolean> => {
|
|
27
27
|
const client = getActiveClient();
|
|
28
28
|
client.log('post/flagPost', postId);
|
|
29
29
|
|
|
30
|
-
const isPredefinedReason =
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const isPredefinedReason =
|
|
31
|
+
reason &&
|
|
32
|
+
Object.entries(ContentFlagReasonEnum).some(
|
|
33
|
+
([key, value]) => key !== ContentFlagReasonEnum.Others && value === reason,
|
|
34
|
+
);
|
|
33
35
|
|
|
34
36
|
const body = {
|
|
35
|
-
reason: isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
36
|
-
detail: isPredefinedReason ?
|
|
37
|
+
reason: reason && isPredefinedReason ? reason : ContentFlagReasonEnum.Others,
|
|
38
|
+
detail: reason && !isPredefinedReason ? reason : '',
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
const { data: payload } = await client.http.post<Amity.PostPayload>(
|