@mapcreator/api 5.0.0-alpha.43 → 5.0.0-alpha.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/utils.js +1 -1
- package/esm/utils.js +1 -1
- package/package.json +1 -1
- package/src/utils.ts +1 -1
package/cjs/utils.js
CHANGED
|
@@ -170,7 +170,7 @@ function getRequestInit(body, extraHeaders, extraOptions) {
|
|
|
170
170
|
const token = (_a = document.cookie.split(/; */)
|
|
171
171
|
.find(pair => pair.startsWith('XSRF-TOKEN'))) === null || _a === void 0 ? void 0 : _a.split('=')[1];
|
|
172
172
|
const method = (_b = extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.method) !== null && _b !== void 0 ? _b : (body != null ? 'POST' : 'GET'); // don't touch `!=` please
|
|
173
|
-
const headers = Object.assign(Object.assign(Object.assign({ Accept: 'application/json' }, contentType), extraHeaders), (method === 'POST' && token && { 'X-
|
|
173
|
+
const headers = Object.assign(Object.assign(Object.assign({ Accept: 'application/json' }, contentType), extraHeaders), (method === 'POST' && token && { 'X-XSRF-Token': token }));
|
|
174
174
|
return { body, headers, method, credentials: 'include' };
|
|
175
175
|
}
|
|
176
176
|
function getContext(revivers, keys = Object.keys(revivers)) {
|
package/esm/utils.js
CHANGED
|
@@ -156,7 +156,7 @@ function getRequestInit(body, extraHeaders, extraOptions) {
|
|
|
156
156
|
const token = (_a = document.cookie.split(/; */)
|
|
157
157
|
.find(pair => pair.startsWith('XSRF-TOKEN'))) === null || _a === void 0 ? void 0 : _a.split('=')[1];
|
|
158
158
|
const method = (_b = extraOptions === null || extraOptions === void 0 ? void 0 : extraOptions.method) !== null && _b !== void 0 ? _b : (body != null ? 'POST' : 'GET'); // don't touch `!=` please
|
|
159
|
-
const headers = Object.assign(Object.assign(Object.assign({ Accept: 'application/json' }, contentType), extraHeaders), (method === 'POST' && token && { 'X-
|
|
159
|
+
const headers = Object.assign(Object.assign(Object.assign({ Accept: 'application/json' }, contentType), extraHeaders), (method === 'POST' && token && { 'X-XSRF-Token': token }));
|
|
160
160
|
return { body, headers, method, credentials: 'include' };
|
|
161
161
|
}
|
|
162
162
|
export function getContext(revivers, keys = Object.keys(revivers)) {
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -265,7 +265,7 @@ function getRequestInit<I extends ApiCommon, O extends Record<string, unknown>>(
|
|
|
265
265
|
Accept: 'application/json',
|
|
266
266
|
...contentType,
|
|
267
267
|
...extraHeaders,
|
|
268
|
-
...(method === 'POST' && token && { 'X-
|
|
268
|
+
...(method === 'POST' && token && { 'X-XSRF-Token': token }),
|
|
269
269
|
};
|
|
270
270
|
|
|
271
271
|
return { body, headers, method, credentials: 'include' } as RequestInit;
|