Working on the tests & sending CSRF

This commit is contained in:
gaba
2017-01-03 18:01:21 -03:00
parent e2a032d4a5
commit 0fd6f4b44e
3 changed files with 12 additions and 8 deletions
+7 -2
View File
@@ -221,8 +221,13 @@ export function postItem (item, type, id) {
*/
export function postAction (item_id, item_type, action) {
return () => {
return coralApi(`/${item_type}/${item_id}/actions`, {method: 'POST', body: action});
return (dispatch, getState) => {
action._csrf = getState().auth.get('_csrf');
return coralApi(`/${item_type}/${item_id}/actions`, {method: 'POST', body: action})
.then((json) => {
dispatch(updateItem(action.item_id, action.action_type, action.id, item_type));
return json;
});
};
}
@@ -1,7 +1,6 @@
import React from 'react';
const Notification = (props) => {
console.log('ACA EL PROBLEMA notification');
if (props.notification.text) {
setTimeout(() => {
props.clearNotification();