Files
astuto/app/javascript/actions/Comment/handleCommentReplies.ts
2022-05-07 11:27:07 +02:00

27 lines
729 B
TypeScript

export const TOGGLE_COMMENT_REPLY = 'TOGGLE_COMMENT_REPLY';
interface ToggleCommentReplyAction {
type: typeof TOGGLE_COMMENT_REPLY;
commentId: number;
}
export const SET_COMMENT_REPLY_BODY = 'SET_COMMENT_REPLY_BODY';
interface SetCommentReplyBodyAction {
type: typeof SET_COMMENT_REPLY_BODY;
commentId: number;
body: string;
}
export const toggleCommentReply = (commentId: number): ToggleCommentReplyAction => ({
type: TOGGLE_COMMENT_REPLY,
commentId,
});
export const setCommentReplyBody = (commentId: number, body: string): SetCommentReplyBodyAction => ({
type: SET_COMMENT_REPLY_BODY,
commentId,
body,
});
export type HandleCommentRepliesType =
ToggleCommentReplyAction |
SetCommentReplyBodyAction;