mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
Add comment replies toggle and body to state
This commit is contained in:
27
app/javascript/actions/handleCommentReplies.ts
Normal file
27
app/javascript/actions/handleCommentReplies.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
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): ToggleCommentReplyAction => ({
|
||||
type: TOGGLE_COMMENT_REPLY,
|
||||
commentId,
|
||||
});
|
||||
|
||||
export const setCommentReplyBody = (commentId, body): SetCommentReplyBodyAction => ({
|
||||
type: SET_COMMENT_REPLY_BODY,
|
||||
commentId,
|
||||
body,
|
||||
});
|
||||
|
||||
export type HandleCommentRepliesType =
|
||||
ToggleCommentReplyAction |
|
||||
SetCommentReplyBodyAction;
|
||||
Reference in New Issue
Block a user