import * as ActionTypes from 'CommentSection/constants'; import { action } from 'typesafe-actions'; import { IComment, IUser } from 'CommentSection/types'; export const fetchCommentsBeginAction = threadId => action(ActionTypes.FETCH_COMMENTS_BEGIN, { threadId }); export const fetchCommentsSuccessAction = (comments: IComment[]) => action(ActionTypes.FETCH_COMMENTS_SUCCESS, { comments }); export const fetchCommentsFailureAction = () => action(ActionTypes.FETCH_COMMENTS_FAILURE); export const createCommentBeginAction = (comment: IComment) => action(ActionTypes.CREATE_COMMENT_BEGIN, { comment }); export const createCommentSuccessAction = comment => action(ActionTypes.CREATE_COMMENT_SUCCESS, { comment }); export const fetchUsersBeginAction = () => action(ActionTypes.FETCH_USERS_BEGIN); export const fetchUsersSuccessAction = (users: IUser[]) => action(ActionTypes.FETCH_USERS_SUCCESS, { users }); export const fetchUsersFailureAction = () => action(ActionTypes.FETCH_USERS_FAILURE); export const setThreadIdBeginAction = (threadId: string) => action(ActionTypes.SET_THREAD_ID, { threadId }); export const deleteCommentBeginAction = (comment: IComment) => action(ActionTypes.DELETE_COMMENT_BEGIN, { comment }); export const deleteCommentSuccessAction = (comment: IComment) => action(ActionTypes.DELETE_COMMENT_SUCCESS, { comment }); export const setReplyUser = (userString: string) => action(ActionTypes.SET_REPLY_USER, { userString });