diff --git a/src/redux/actions/commentActions.tsx b/src/redux/actions/commentActions.tsx index b4bb59af..0817ae28 100644 --- a/src/redux/actions/commentActions.tsx +++ b/src/redux/actions/commentActions.tsx @@ -119,7 +119,6 @@ export const createCommentAction = (blogId: string, content: string) => async (d type: CREATE_COMMENT_SUCCESS, payload: createdComment, }); - toast.success("Comment created successfully!"); } catch (err: any) { const errorMessage = err.response?.data?.errors?.[0]?.message || err.message || "Failed to create comment"; @@ -165,7 +164,7 @@ export const updateCommentAction = (commentId: string, updateFields: any) => asy type: UPDATE_COMMENT_SUCCESS, payload: updatedComment, }); - toast.success("Comment updated successfully!"); + } catch (err: any) { const errorMessage = err.response?.data?.errors?.[0]?.message || err.message || "Failed to update comment"; dispatch({ @@ -193,7 +192,7 @@ export const deleteCommentAction = (commentId: string) => async (dispatch: any) type: DELETE_COMMENT_SUCCESS, payload: commentId, }); - toast.success("Comment deleted successfully!"); + } catch (err: any) { const errorMessage = err.response?.data?.errors?.[0]?.message || err.message || "Failed to delete comment"; dispatch({ @@ -306,7 +305,7 @@ export const addReplyToComment = (content: string, commentId: string) => async ( type: ADD_REPLY_SUCCESS, payload: { commentId, reply: newReply }, }); - toast.success("Reply added successfully!"); + } catch (err: any) { const errorMessage = err.response?.data?.errors?.[0]?.message || err.message || "Failed to add reply"; diff --git a/src/redux/actions/reactionActions.tsx b/src/redux/actions/reactionActions.tsx index d1fbf744..ff4a1bde 100644 --- a/src/redux/actions/reactionActions.tsx +++ b/src/redux/actions/reactionActions.tsx @@ -34,7 +34,6 @@ export const getReactionsByBlogId = (blogId: string) => async (dispatch: any) => dispatch(creator(fetchReactions.FETCH_REACTIONS_SUCCESS, reactionCounts)); } catch (err: any) { dispatch(creator(fetchReactions.FETCH_REACTIONS_FAILURE, err.message)); - toast.error("Failed to fetch reactions."); } }; @@ -73,7 +72,7 @@ export const addReactionAction = (blogId: string, type: string) => async (dispat const reaction = response?.data?.data?.addReaction; dispatch(creator(addReaction.ADD_REACTION_SUCCESS, reaction)); - toast.success("Reaction added successfully!"); + } catch (err: any) { dispatch(creator(addReaction.ADD_REACTION_FAIL, err.message)); toast.error("Failed to add reaction."); @@ -103,9 +102,7 @@ export const removeReactionAction = (blogId: string) => async (dispatch: any) => }); dispatch(creator(removeReaction.REMOVE_REACTION_SUCCESS, { userId, blogId })); - toast.success("Reaction removed successfully!"); } catch (err: any) { dispatch(creator(removeReaction.REMOVE_REACTION_FAIL, err.message)); - toast.error("Failed to remove reaction."); } };