@goralys/core 1.4.2 → 1.4.4
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/dist/index.d.ts +1 -1
- package/dist/index.js +10 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -414,17 +414,21 @@ var GoralysActionHandler = class {
|
|
|
414
414
|
// src/lib/fetch/fetch.client.ts
|
|
415
415
|
var actionHandler = new GoralysActionHandler();
|
|
416
416
|
async function goralysFetchClient(method, input, payload, requestOptions) {
|
|
417
|
-
|
|
417
|
+
if (requestOptions?.body)
|
|
418
|
+
console.error("[Fetch] Found body inside request options. This is not allowed, consider using the payload parameter instead");
|
|
419
|
+
const { apiDomain, getSchoolToken, isNative } = getGoralysClientConfig();
|
|
420
|
+
const { headers: extraHeaders, ...restOptions } = requestOptions ?? {};
|
|
418
421
|
const res = await fetch(`${apiDomain}/${input}`, {
|
|
419
422
|
credentials: "include",
|
|
420
423
|
method: method === "BREW" ? "POST" : method,
|
|
421
424
|
headers: {
|
|
422
425
|
...method === "BREW" ? { "X-HTTP-Method-Override": method } : {},
|
|
423
|
-
"X-High-School-Token":
|
|
424
|
-
"X-Goralys-Client": isNative ? "mobile" : "desktop"
|
|
426
|
+
"X-High-School-Token": getSchoolToken(),
|
|
427
|
+
"X-Goralys-Client": isNative ? "mobile" : "desktop",
|
|
428
|
+
...extraHeaders
|
|
425
429
|
},
|
|
426
430
|
body: payload ? payload instanceof FormData ? payload : JSON.stringify(payload) : void 0,
|
|
427
|
-
...
|
|
431
|
+
...restOptions
|
|
428
432
|
});
|
|
429
433
|
const clone = res.clone();
|
|
430
434
|
const contentType = clone.headers.get("Content-Type");
|
|
@@ -454,12 +458,12 @@ async function goralysFetchClient(method, input, payload, requestOptions) {
|
|
|
454
458
|
return res;
|
|
455
459
|
}
|
|
456
460
|
async function fetchCsrfClient(formId) {
|
|
457
|
-
const { apiDomain,
|
|
461
|
+
const { apiDomain, getSchoolToken, isNative } = getGoralysClientConfig();
|
|
458
462
|
const res = await fetch(`${apiDomain}/csrf`, {
|
|
459
463
|
method: "POST",
|
|
460
464
|
headers: {
|
|
461
465
|
"Content-Type": "application/json",
|
|
462
|
-
"X-High-School-Token":
|
|
466
|
+
"X-High-School-Token": getSchoolToken(),
|
|
463
467
|
"X-Goralys-Client": isNative ? "mobile" : "desktop"
|
|
464
468
|
},
|
|
465
469
|
credentials: "include",
|