@goralys/core 1.4.0 → 1.4.1
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 -0
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -414,11 +414,15 @@ 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
|
-
const { apiDomain, schoolToken } = getGoralysClientConfig();
|
|
417
|
+
const { apiDomain, schoolToken, isNative } = getGoralysClientConfig();
|
|
418
418
|
const res = await fetch(`${apiDomain}/${input}`, {
|
|
419
419
|
credentials: "include",
|
|
420
420
|
method: method === "BREW" ? "POST" : method,
|
|
421
|
-
headers: {
|
|
421
|
+
headers: {
|
|
422
|
+
...method === "BREW" ? { "X-HTTP-Method-Override": method } : {},
|
|
423
|
+
"X-High-School-Token": schoolToken,
|
|
424
|
+
"X-Goralys-Client": isNative ? "mobile" : "desktop"
|
|
425
|
+
},
|
|
422
426
|
body: payload ? payload instanceof FormData ? payload : JSON.stringify(payload) : void 0,
|
|
423
427
|
...requestOptions
|
|
424
428
|
});
|
|
@@ -447,10 +451,14 @@ async function goralysFetchClient(method, input, payload, requestOptions) {
|
|
|
447
451
|
return res;
|
|
448
452
|
}
|
|
449
453
|
async function fetchCsrfClient(formId) {
|
|
450
|
-
const { apiDomain, schoolToken } = getGoralysClientConfig();
|
|
454
|
+
const { apiDomain, schoolToken, isNative } = getGoralysClientConfig();
|
|
451
455
|
const res = await fetch(`${apiDomain}/csrf`, {
|
|
452
456
|
method: "POST",
|
|
453
|
-
headers: {
|
|
457
|
+
headers: {
|
|
458
|
+
"Content-Type": "application/json",
|
|
459
|
+
"X-High-School-Token": schoolToken,
|
|
460
|
+
"X-Goralys-Client": isNative ? "mobile" : "desktop"
|
|
461
|
+
},
|
|
454
462
|
credentials: "include",
|
|
455
463
|
body: JSON.stringify({ form: formId })
|
|
456
464
|
});
|