Enable redux dev tools and refactor http requests

This commit is contained in:
Riccardo Graziosi
2022-04-09 10:45:43 +02:00
parent ad67c3986b
commit 1803c293ff
10 changed files with 27 additions and 45 deletions

View File

@@ -10,6 +10,7 @@ import {
import Button from '../shared/Button';
import IBoard from '../../interfaces/IBoard';
import buildRequestHeaders from '../../helpers/buildRequestHeaders';
interface Props {
board: IBoard;
@@ -93,11 +94,7 @@ class NewPost extends React.Component<Props, State> {
try {
const res = await fetch('/posts', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-CSRF-Token': authenticityToken,
},
headers: buildRequestHeaders(authenticityToken),
body: JSON.stringify({
post: {
title,