mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Improve type checks
This commit is contained in:
@@ -5,7 +5,7 @@ import { State } from '../reducers/rootReducer';
|
||||
export const CHANGE_POST_BOARD_SUCCESS = 'CHANGE_POST_BOARD_SUCCESS';
|
||||
export interface ChangePostBoardSuccessAction {
|
||||
type: typeof CHANGE_POST_BOARD_SUCCESS;
|
||||
newBoardId;
|
||||
newBoardId: number;
|
||||
}
|
||||
|
||||
const changePostBoardSuccess = (newBoardId: number): ChangePostBoardSuccessAction => ({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { State } from '../reducers/rootReducer';
|
||||
export const CHANGE_POST_STATUS_SUCCESS = 'CHANGE_POST_STATUS_SUCCESS';
|
||||
export interface ChangePostStatusSuccessAction {
|
||||
type: typeof CHANGE_POST_STATUS_SUCCESS;
|
||||
newPostStatusId;
|
||||
newPostStatusId: number;
|
||||
}
|
||||
|
||||
const changePostStatusSuccess = (newPostStatusId: number): ChangePostStatusSuccessAction => ({
|
||||
|
||||
@@ -11,12 +11,12 @@ interface SetCommentReplyBodyAction {
|
||||
body: string;
|
||||
}
|
||||
|
||||
export const toggleCommentReply = (commentId): ToggleCommentReplyAction => ({
|
||||
export const toggleCommentReply = (commentId: number): ToggleCommentReplyAction => ({
|
||||
type: TOGGLE_COMMENT_REPLY,
|
||||
commentId,
|
||||
});
|
||||
|
||||
export const setCommentReplyBody = (commentId, body): SetCommentReplyBodyAction => ({
|
||||
export const setCommentReplyBody = (commentId: number, body: string): SetCommentReplyBodyAction => ({
|
||||
type: SET_COMMENT_REPLY_BODY,
|
||||
commentId,
|
||||
body,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ICommentJSON from '../interfaces/json/IComment';
|
||||
|
||||
export const COMMENT_REQUEST_SUCCESS = 'COMMENT_REQUEST_SUCCESS';
|
||||
interface CommentRequestSuccessAction {
|
||||
export interface CommentRequestSuccessAction {
|
||||
type: typeof COMMENT_REQUEST_SUCCESS;
|
||||
comment: ICommentJSON;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export type CommentSubmitActionTypes =
|
||||
CommentSubmitSuccessAction |
|
||||
CommentSubmitFailureAction;
|
||||
|
||||
const commentSubmitStart = (parentId): CommentSubmitStartAction => ({
|
||||
const commentSubmitStart = (parentId: number): CommentSubmitStartAction => ({
|
||||
type: COMMENT_SUBMIT_START,
|
||||
parentId,
|
||||
});
|
||||
@@ -40,17 +40,17 @@ const commentSubmitSuccess = (
|
||||
comment: commentJSON,
|
||||
});
|
||||
|
||||
const commentSubmitFailure = (parentId, error): CommentSubmitFailureAction => ({
|
||||
const commentSubmitFailure = (parentId: number, error: string): CommentSubmitFailureAction => ({
|
||||
type: COMMENT_SUBMIT_FAILURE,
|
||||
parentId,
|
||||
error,
|
||||
});
|
||||
|
||||
export const submitComment = (
|
||||
postId,
|
||||
body,
|
||||
parentId,
|
||||
authenticityToken,
|
||||
postId: number,
|
||||
body: string,
|
||||
parentId: number,
|
||||
authenticityToken: string,
|
||||
): ThunkAction<void, State, null, Action<string>> => async (dispatch) => {
|
||||
dispatch(commentSubmitStart(parentId));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user