elbe-ui 0.4.15 → 0.4.16

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.
@@ -15,7 +15,10 @@ export interface PostArgs extends GetArgs {
15
15
  */
16
16
  export declare class ApiWorker {
17
17
  private apiURL;
18
- constructor(apiURL: string);
18
+ private o?;
19
+ constructor(apiURL: string, o?: {
20
+ credentials?: "omit" | "include" | "same-origin";
21
+ } | undefined);
19
22
  private _fetch;
20
23
  get(path: string, args?: GetArgs): Promise<any>;
21
24
  post(path: string, args: PostArgs): Promise<any>;
@@ -14,11 +14,13 @@ const _noArgs = {};
14
14
  * to use it, you must first call `ApiService.init(apiURL)` with the base URL of your API.
15
15
  */
16
16
  export class ApiWorker {
17
- constructor(apiURL) {
17
+ constructor(apiURL, o) {
18
18
  this.apiURL = apiURL;
19
+ this.o = o;
19
20
  }
20
21
  _fetch(p_1, method_1, _a) {
21
22
  return __awaiter(this, arguments, void 0, function* (p, method, { path, query, body }) {
23
+ var _b, _c;
22
24
  try {
23
25
  p = path
24
26
  ? p.replace(/:([a-zA-Z0-9_]+)/g, (m, p1) => {
@@ -32,7 +34,7 @@ export class ApiWorker {
32
34
  const queryStr = query != null ? "?" + new URLSearchParams(query).toString() : "";
33
35
  const response = yield fetch(this.apiURL + p + queryStr, {
34
36
  method,
35
- credentials: "include",
37
+ credentials: (_c = (_b = this.o) === null || _b === void 0 ? void 0 : _b.credentials) !== null && _c !== void 0 ? _c : "same-origin",
36
38
  headers: { "Content-Type": "application/json" },
37
39
  body: body ? JSON.stringify(body) : undefined,
38
40
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
- "version": "0.4.15",
3
+ "version": "0.4.16",
4
4
  "author": "Robin Naumann",
5
5
  "license": "MIT",
6
6
  "repository": {