mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 11:47:56 +01:00
New comments can be created
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
import {
|
||||
COMMENT_REQUEST_SUCCESS,
|
||||
} from '../actions/requestComment';
|
||||
|
||||
import {
|
||||
HandleCommentRepliesType,
|
||||
TOGGLE_COMMENT_REPLY,
|
||||
SET_COMMENT_REPLY_BODY,
|
||||
} from '../actions/handleCommentReplies';
|
||||
|
||||
import {
|
||||
COMMENT_SUBMIT_START,
|
||||
COMMENT_SUBMIT_SUCCESS,
|
||||
COMMENT_SUBMIT_FAILURE,
|
||||
} from '../actions/submitComment';
|
||||
|
||||
export interface CommentRepliesState {
|
||||
commentId: number;
|
||||
isOpen: boolean;
|
||||
body: string;
|
||||
isSubmitting: boolean;
|
||||
error: string;
|
||||
}
|
||||
|
||||
const initialState: CommentRepliesState = {
|
||||
commentId: undefined,
|
||||
isOpen: false,
|
||||
body: '',
|
||||
isSubmitting: false,
|
||||
error: '',
|
||||
}
|
||||
|
||||
const commentRepliesReducer = (
|
||||
@@ -42,6 +53,27 @@ const commentRepliesReducer = (
|
||||
body: action.body,
|
||||
};
|
||||
|
||||
case COMMENT_SUBMIT_START:
|
||||
return {
|
||||
...state,
|
||||
isSubmitting: true,
|
||||
};
|
||||
|
||||
case COMMENT_SUBMIT_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
isOpen: false,
|
||||
body: '',
|
||||
isSubmitting: false,
|
||||
error: '',
|
||||
};
|
||||
|
||||
case COMMENT_SUBMIT_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
error: action.error,
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user