Browse Source

messages fix adding

pocu46 4 years ago
parent
commit
7f2c9c171e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      hipstagram/src/Redux/state.js

+ 3 - 3
hipstagram/src/Redux/state.js

@@ -53,15 +53,15 @@ let store = {
             this._state.messagesPage.newMessageBody = action.body;
             this._callSubscriber(this._state);
         } else if(action.type === SEND_MESSAGE) {
-            let body = this._state.messagesPage.newMessageBody = action.body;
+            let body = this._state.messagesPage.newMessageBody;
             this._state.messagesPage.newMessageBody = 0;
-            this._state.messagesPage.newMessageBody.push({ id: 4, message: body });
+            this._state.messagesPage.messagesData.push({ id: 4, message: body });
             this._callSubscriber(this._state);
         }
     }
 };
 
-export const addPostActionCreator = () => ({ type: 'ADD-POST' });
+export const addPostActionCreator = (body) => ({ type: 'ADD-POST', body });
 export const updateNewPostTextActionCreator = (text) => {
     return {
         type: 'UPDATE-NEW-POST-TEXT',