Skip to content

Commit 4a0786b

Browse files
dawehnermattgrill
authored andcommitted
Fix POST requests from api.js (#605)
Moving api.js to the utilities package introduced a couple of bugs, one was saving no longer works. As part of that I started to gitignore `build/index.js` as we don't need this in version control.
1 parent 6567ab7 commit 4a0786b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

packages/utilities/build/index.js

Whitespace-only changes.

packages/utilities/src/api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async function api(
129129
delete node.relationships.type;
130130
delete node.relationships.uid;
131131

132-
const saveToken = await api('csrf_token');
132+
const saveToken = await api(REACT_APP_DRUPAL_BASE_URL, 'csrf_token');
133133
options.headers.Accept = 'application/vnd.api+json';
134134
options.headers['X-CSRF-Token'] = saveToken;
135135
options.method = 'POST';
@@ -147,7 +147,7 @@ async function api(
147147
: `node--${parameters.node.type}`,
148148
};
149149

150-
const saveToken = await api('csrf_token');
150+
const saveToken = await api(REACT_APP_DRUPAL_BASE_URL, 'csrf_token');
151151
options.headers.Accept = 'application/vnd.api+json';
152152
options.headers['X-CSRF-Token'] = saveToken;
153153
options.method = 'PATCH';

0 commit comments

Comments
 (0)