@ercioko/meblotex-api 0.2.0 → 0.2.2

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.
Files changed (193) hide show
  1. package/.eslintrc +6 -0
  2. package/.nvmrc +1 -0
  3. package/.prettierrc +11 -0
  4. package/package.json +5 -16
  5. package/src/api/Api.ts +140 -0
  6. package/src/api/Endpoint.ts +76 -0
  7. package/src/api/createApi.ts +116 -0
  8. package/src/api/error.ts +17 -0
  9. package/{dist/api/index.d.ts → src/api/index.ts} +1 -0
  10. package/src/api/status.ts +3 -0
  11. package/src/api/utils/getAlert.ts +75 -0
  12. package/src/app_types.ts +695 -0
  13. package/src/components/ApiHostProvider.tsx +13 -0
  14. package/src/components/StatusTag.tsx +83 -0
  15. package/src/components/Table/DataTableWrapper.tsx +28 -0
  16. package/src/components/Table/FloatingActions.tsx +152 -0
  17. package/src/components/Table/Spinner.tsx +35 -0
  18. package/src/components/Table/Summary.tsx +18 -0
  19. package/src/components/Table/Table.tsx +474 -0
  20. package/src/components/Table/addIndexToObject.ts +6 -0
  21. package/src/components/Table/areProvidedColumnsDifferent.ts +26 -0
  22. package/src/components/Table/clicked.js +12 -0
  23. package/src/components/Table/displayActions.tsx +19 -0
  24. package/src/components/Table/hooks/useFetchPage.tsx +83 -0
  25. package/src/components/Table/hooks/useGetCellRenderer.tsx +197 -0
  26. package/src/components/Table/hooks/useGetColumnsWithCheckbox.tsx +34 -0
  27. package/src/components/Table/hooks/useGetDeleteRow.tsx +37 -0
  28. package/src/components/Table/hooks/useGetResizeColumn.ts +33 -0
  29. package/src/components/Table/hooks/useGetRowCheckbox.tsx +25 -0
  30. package/src/components/Table/hooks/useLoadDataSource.ts +24 -0
  31. package/src/components/Table/hooks/usePageSize.tsx +20 -0
  32. package/src/components/Table/hooks/useRenderRowActions.tsx +45 -0
  33. package/src/components/Table/hooks/useResizeColumns.ts +61 -0
  34. package/src/components/Table/index.ts +1 -0
  35. package/src/components/Table/providers/OrderProvider.tsx +20 -0
  36. package/src/components/Table/styles.ts +208 -0
  37. package/src/config.ts +7 -0
  38. package/src/db_types.ts +220 -0
  39. package/src/hooks/useApi.ts +43 -0
  40. package/src/hooks/useEndpoint.ts +35 -0
  41. package/src/lib/jednostkaNazwa.ts +6 -0
  42. package/src/lib/typDokumentuNazwa.ts +8 -0
  43. package/src/utils/Query.ts +30 -0
  44. package/src/utils/getWZNumber.ts +13 -0
  45. package/src/utils/getZamowienieDokumentNumber.ts +11 -0
  46. package/{dist/src/utils/index.js → src/utils/index.ts} +2 -2
  47. package/tsconfig.json +25 -0
  48. package/tsconfig.tsbuildinfo +1 -0
  49. package/dist/api/Api.d.ts +0 -33
  50. package/dist/api/Api.js +0 -152
  51. package/dist/api/Endpoint.d.ts +0 -13
  52. package/dist/api/Endpoint.js +0 -126
  53. package/dist/api/createApi.d.ts +0 -52
  54. package/dist/api/createApi.js +0 -81
  55. package/dist/api/error.d.ts +0 -15
  56. package/dist/api/error.js +0 -18
  57. package/dist/api/index.js +0 -34
  58. package/dist/api/status.d.ts +0 -3
  59. package/dist/api/status.js +0 -6
  60. package/dist/api/utils/getAlert.d.ts +0 -6
  61. package/dist/api/utils/getAlert.js +0 -65
  62. package/dist/api/utils/index.js +0 -8
  63. package/dist/app_types.d.ts +0 -607
  64. package/dist/app_types.js +0 -75
  65. package/dist/components/ApiHostProvider.d.ts +0 -7
  66. package/dist/components/ApiHostProvider.js +0 -35
  67. package/dist/components/StatusTag.d.ts +0 -11
  68. package/dist/components/StatusTag.js +0 -86
  69. package/dist/components/Table/DataTableWrapper.d.ts +0 -3
  70. package/dist/components/Table/DataTableWrapper.js +0 -44
  71. package/dist/components/Table/FloatingActions.d.ts +0 -14
  72. package/dist/components/Table/FloatingActions.js +0 -32
  73. package/dist/components/Table/Spinner.d.ts +0 -2
  74. package/dist/components/Table/Spinner.js +0 -26
  75. package/dist/components/Table/Summary.js +0 -16
  76. package/dist/components/Table/Table.d.ts +0 -28
  77. package/dist/components/Table/Table.js +0 -330
  78. package/dist/components/Table/addIndexToObject.d.ts +0 -3
  79. package/dist/components/Table/addIndexToObject.js +0 -17
  80. package/dist/components/Table/areProvidedColumnsDifferent.d.ts +0 -2
  81. package/dist/components/Table/areProvidedColumnsDifferent.js +0 -16
  82. package/dist/components/Table/clicked.js +0 -11
  83. package/dist/components/Table/displayActions.js +0 -11
  84. package/dist/components/Table/hooks/useFetchPage.d.ts +0 -18
  85. package/dist/components/Table/hooks/useFetchPage.js +0 -123
  86. package/dist/components/Table/hooks/useGetCellRenderer.d.ts +0 -25
  87. package/dist/components/Table/hooks/useGetCellRenderer.js +0 -166
  88. package/dist/components/Table/hooks/useGetColumnsWithCheckbox.d.ts +0 -5
  89. package/dist/components/Table/hooks/useGetColumnsWithCheckbox.js +0 -53
  90. package/dist/components/Table/hooks/useGetDeleteRow.d.ts +0 -9
  91. package/dist/components/Table/hooks/useGetDeleteRow.js +0 -74
  92. package/dist/components/Table/hooks/useGetResizeColumn.d.ts +0 -8
  93. package/dist/components/Table/hooks/useGetResizeColumn.js +0 -28
  94. package/dist/components/Table/hooks/useGetRowCheckbox.d.ts +0 -5
  95. package/dist/components/Table/hooks/useGetRowCheckbox.js +0 -54
  96. package/dist/components/Table/hooks/useLoadDataSource.d.ts +0 -10
  97. package/dist/components/Table/hooks/useLoadDataSource.js +0 -20
  98. package/dist/components/Table/hooks/usePageSize.d.ts +0 -5
  99. package/dist/components/Table/hooks/usePageSize.js +0 -16
  100. package/dist/components/Table/hooks/useRenderRowActions.d.ts +0 -6
  101. package/dist/components/Table/hooks/useRenderRowActions.js +0 -51
  102. package/dist/components/Table/hooks/useResizeColumns.d.ts +0 -9
  103. package/dist/components/Table/hooks/useResizeColumns.js +0 -60
  104. package/dist/components/Table/index.d.ts +0 -1
  105. package/dist/components/Table/index.js +0 -8
  106. package/dist/components/Table/providers/OrderProvider.d.ts +0 -9
  107. package/dist/components/Table/providers/OrderProvider.js +0 -17
  108. package/dist/components/Table/styles.d.ts +0 -6
  109. package/dist/components/Table/styles.js +0 -37
  110. package/dist/components/index.js +0 -26
  111. package/dist/config.d.ts +0 -6
  112. package/dist/config.js +0 -8
  113. package/dist/db_types.d.ts +0 -208
  114. package/dist/db_types.js +0 -2
  115. package/dist/hooks/index.js +0 -10
  116. package/dist/hooks/useApi.d.ts +0 -2
  117. package/dist/hooks/useApi.js +0 -42
  118. package/dist/hooks/useEndpoint.d.ts +0 -2
  119. package/dist/hooks/useEndpoint.js +0 -34
  120. package/dist/index.js +0 -19
  121. package/dist/lib/index.js +0 -18
  122. package/dist/lib/jednostka.d.ts +0 -6
  123. package/dist/lib/jednostkaNazwa.d.ts +0 -6
  124. package/dist/lib/jednostkaNazwa.js +0 -9
  125. package/dist/lib/typDokumentuNazwa.d.ts +0 -6
  126. package/dist/lib/typDokumentuNazwa.js +0 -11
  127. package/dist/lib/typ_dokument.d.ts +0 -0
  128. package/dist/lib/typ_dokumentu.d.ts +0 -6
  129. package/dist/lib/unit.d.ts +0 -0
  130. package/dist/src/api/Api.js +0 -316
  131. package/dist/src/api/Endpoint.js +0 -365
  132. package/dist/src/api/createApi.js +0 -50
  133. package/dist/src/api/error.js +0 -15
  134. package/dist/src/api/index.js +0 -5
  135. package/dist/src/api/status.js +0 -3
  136. package/dist/src/api/utils/getAlert.js +0 -63
  137. package/dist/src/api/utils/index.js +0 -1
  138. package/dist/src/app_types.js +0 -72
  139. package/dist/src/components/ApiHostProvider.js +0 -11
  140. package/dist/src/components/StatusTag.js +0 -153
  141. package/dist/src/components/Table/DataTableWrapper.js +0 -115
  142. package/dist/src/components/Table/FloatingActions.js +0 -60
  143. package/dist/src/components/Table/Spinner.js +0 -40
  144. package/dist/src/components/Table/Summary.js +0 -16
  145. package/dist/src/components/Table/Table.js +0 -498
  146. package/dist/src/components/Table/addIndexToObject.js +0 -57
  147. package/dist/src/components/Table/areProvidedColumnsDifferent.js +0 -19
  148. package/dist/src/components/Table/clicked.js +0 -12
  149. package/dist/src/components/Table/displayActions.js +0 -11
  150. package/dist/src/components/Table/hooks/useFetchPage.js +0 -254
  151. package/dist/src/components/Table/hooks/useGetCellRenderer.js +0 -231
  152. package/dist/src/components/Table/hooks/useGetColumnsWithCheckbox.js +0 -33
  153. package/dist/src/components/Table/hooks/useGetDeleteRow.js +0 -181
  154. package/dist/src/components/Table/hooks/useGetResizeColumn.js +0 -72
  155. package/dist/src/components/Table/hooks/useGetRowCheckbox.js +0 -55
  156. package/dist/src/components/Table/hooks/useLoadDataSource.js +0 -16
  157. package/dist/src/components/Table/hooks/usePageSize.js +0 -15
  158. package/dist/src/components/Table/hooks/useRenderRowActions.js +0 -50
  159. package/dist/src/components/Table/hooks/useResizeColumns.js +0 -70
  160. package/dist/src/components/Table/index.js +0 -1
  161. package/dist/src/components/Table/providers/OrderProvider.js +0 -65
  162. package/dist/src/components/Table/styles.js +0 -66
  163. package/dist/src/components/index.js +0 -4
  164. package/dist/src/config.js +0 -6
  165. package/dist/src/db_types.js +0 -1
  166. package/dist/src/hooks/index.js +0 -2
  167. package/dist/src/hooks/useApi.js +0 -84
  168. package/dist/src/hooks/useEndpoint.js +0 -60
  169. package/dist/src/index.js +0 -3
  170. package/dist/src/lib/index.js +0 -2
  171. package/dist/src/lib/jednostkaNazwa.js +0 -6
  172. package/dist/src/lib/typDokumentuNazwa.js +0 -16
  173. package/dist/src/utils/Query.js +0 -73
  174. package/dist/src/utils/getWZNumber.js +0 -4
  175. package/dist/src/utils/getZamowienieDokumentNumber.js +0 -4
  176. package/dist/utils/AlertContext.d.ts +0 -3
  177. package/dist/utils/AlertContext.js +0 -3
  178. package/dist/utils/Query.d.ts +0 -6
  179. package/dist/utils/Query.js +0 -33
  180. package/dist/utils/geNumber.d.ts +0 -2
  181. package/dist/utils/getDocNumber.d.ts +0 -2
  182. package/dist/utils/getWZNumber.js +0 -10
  183. package/dist/utils/getWzNumber.d.ts +0 -2
  184. package/dist/utils/getZamowienieDokumentNumber copy.d.ts +0 -2
  185. package/dist/utils/getZamowienieDokumentNumber.d.ts +0 -2
  186. package/dist/utils/getZamowienieDokumentNumber.js +0 -8
  187. package/dist/utils/index.d.ts +0 -3
  188. package/dist/utils/index.js +0 -12
  189. /package/{dist/api/utils/index.d.ts → src/api/utils/index.ts} +0 -0
  190. /package/{dist/components/index.d.ts → src/components/index.ts} +0 -0
  191. /package/{dist/hooks/index.d.ts → src/hooks/index.ts} +0 -0
  192. /package/{dist/index.d.ts → src/index.ts} +0 -0
  193. /package/{dist/lib/index.d.ts → src/lib/index.ts} +0 -0
package/dist/lib/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./jednostkaNazwa"), exports);
18
- __exportStar(require("./typDokumentuNazwa"), exports);
@@ -1,6 +0,0 @@
1
- export declare const jednostkaNazwa: {
2
- '-1': string;
3
- 0: string;
4
- 1: string;
5
- 3: string;
6
- };
@@ -1,6 +0,0 @@
1
- export declare const jednostkaNazwa: {
2
- '-1': string;
3
- 0: string;
4
- 1: string;
5
- 3: string;
6
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jednostkaNazwa = void 0;
4
- exports.jednostkaNazwa = {
5
- '-1': 'm2', // Front systemowy ?
6
- 0: '', // Front systemowy ?
7
- 1: 'szt',
8
- 3: 'm2',
9
- };
@@ -1,6 +0,0 @@
1
- export declare const typDokumentuNazwa: {
2
- FA: string;
3
- DE: string;
4
- EX: string;
5
- PA: string;
6
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.typDokumentuNazwa = void 0;
5
- var app_types_1 = require("../app_types");
6
- exports.typDokumentuNazwa = (_a = {},
7
- _a[app_types_1.TypDokumentu.Faktura] = 'Faktura VAT',
8
- _a[app_types_1.TypDokumentu.FakturaDetal] = 'Faktura FADET',
9
- _a[app_types_1.TypDokumentu.FakturaEksport] = 'Faktura Eksportowa',
10
- _a[app_types_1.TypDokumentu.Paragon] = 'Paragon',
11
- _a);
File without changes
@@ -1,6 +0,0 @@
1
- export declare const typDokumentuNazwa: {
2
- FA: string;
3
- DE: string;
4
- EX: string;
5
- PA: string;
6
- };
File without changes
@@ -1,316 +0,0 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
- try {
3
- var info = gen[key](arg);
4
- var value = info.value;
5
- } catch (error) {
6
- reject(error);
7
- return;
8
- }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
14
- }
15
- function _async_to_generator(fn) {
16
- return function() {
17
- var self = this, args = arguments;
18
- return new Promise(function(resolve, reject) {
19
- var gen = fn.apply(self, args);
20
- function _next(value) {
21
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
- }
23
- function _throw(err) {
24
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
- }
26
- _next(undefined);
27
- });
28
- };
29
- }
30
- function _class_call_check(instance, Constructor) {
31
- if (!(instance instanceof Constructor)) {
32
- throw new TypeError("Cannot call a class as a function");
33
- }
34
- }
35
- function _defineProperties(target, props) {
36
- for(var i = 0; i < props.length; i++){
37
- var descriptor = props[i];
38
- descriptor.enumerable = descriptor.enumerable || false;
39
- descriptor.configurable = true;
40
- if ("value" in descriptor) descriptor.writable = true;
41
- Object.defineProperty(target, descriptor.key, descriptor);
42
- }
43
- }
44
- function _create_class(Constructor, protoProps, staticProps) {
45
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46
- if (staticProps) _defineProperties(Constructor, staticProps);
47
- return Constructor;
48
- }
49
- function _define_property(obj, key, value) {
50
- if (key in obj) {
51
- Object.defineProperty(obj, key, {
52
- value: value,
53
- enumerable: true,
54
- configurable: true,
55
- writable: true
56
- });
57
- } else {
58
- obj[key] = value;
59
- }
60
- return obj;
61
- }
62
- function _ts_generator(thisArg, body) {
63
- var f, y, t, g, _ = {
64
- label: 0,
65
- sent: function() {
66
- if (t[0] & 1) throw t[1];
67
- return t[1];
68
- },
69
- trys: [],
70
- ops: []
71
- };
72
- return g = {
73
- next: verb(0),
74
- "throw": verb(1),
75
- "return": verb(2)
76
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
77
- return this;
78
- }), g;
79
- function verb(n) {
80
- return function(v) {
81
- return step([
82
- n,
83
- v
84
- ]);
85
- };
86
- }
87
- function step(op) {
88
- if (f) throw new TypeError("Generator is already executing.");
89
- while(_)try {
90
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
91
- if (y = 0, t) op = [
92
- op[0] & 2,
93
- t.value
94
- ];
95
- switch(op[0]){
96
- case 0:
97
- case 1:
98
- t = op;
99
- break;
100
- case 4:
101
- _.label++;
102
- return {
103
- value: op[1],
104
- done: false
105
- };
106
- case 5:
107
- _.label++;
108
- y = op[1];
109
- op = [
110
- 0
111
- ];
112
- continue;
113
- case 7:
114
- op = _.ops.pop();
115
- _.trys.pop();
116
- continue;
117
- default:
118
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
119
- _ = 0;
120
- continue;
121
- }
122
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
123
- _.label = op[1];
124
- break;
125
- }
126
- if (op[0] === 6 && _.label < t[1]) {
127
- _.label = t[1];
128
- t = op;
129
- break;
130
- }
131
- if (t && _.label < t[2]) {
132
- _.label = t[2];
133
- _.ops.push(op);
134
- break;
135
- }
136
- if (t[2]) _.ops.pop();
137
- _.trys.pop();
138
- continue;
139
- }
140
- op = body.call(thisArg, _);
141
- } catch (e) {
142
- op = [
143
- 6,
144
- e
145
- ];
146
- y = 0;
147
- } finally{
148
- f = t = 0;
149
- }
150
- if (op[0] & 5) throw op[1];
151
- return {
152
- value: op[0] ? op[1] : void 0,
153
- done: true
154
- };
155
- }
156
- }
157
- import { Query } from '../utils';
158
- function handleResponse(res) {
159
- return _handleResponse.apply(this, arguments);
160
- }
161
- function _handleResponse() {
162
- _handleResponse = _async_to_generator(function(res) {
163
- var ok, url, headers, status, statusText, text;
164
- return _ts_generator(this, function(_state) {
165
- switch(_state.label){
166
- case 0:
167
- if (res.status === 204) return [
168
- 2,
169
- {}
170
- ];
171
- if (res.status.toString().startsWith('2')) return [
172
- 2,
173
- res.json()
174
- ];
175
- ok = res.ok, url = res.url, headers = res.headers, status = res.status, statusText = res.statusText;
176
- return [
177
- 4,
178
- res.text()
179
- ];
180
- case 1:
181
- text = _state.sent();
182
- throw new Error(JSON.stringify({
183
- ok: ok,
184
- url: url,
185
- headers: headers,
186
- status: status,
187
- statusText: statusText,
188
- text: text
189
- }));
190
- }
191
- });
192
- });
193
- return _handleResponse.apply(this, arguments);
194
- }
195
- var Api = /*#__PURE__*/ function() {
196
- "use strict";
197
- function Api(endpoint, host) {
198
- _class_call_check(this, Api);
199
- _define_property(this, "host", void 0);
200
- _define_property(this, "namespace", void 0);
201
- _define_property(this, "endpoint", void 0);
202
- _define_property(this, "endpointUrl", void 0);
203
- this.host = host;
204
- this.namespace = '';
205
- this.endpoint = endpoint;
206
- this.endpointUrl = "".concat(this.host).concat(this.namespace, "/").concat(this.endpoint);
207
- }
208
- _create_class(Api, [
209
- {
210
- key: "get",
211
- value: function get() {
212
- var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
213
- var _this = this;
214
- return _async_to_generator(function() {
215
- var headers, options, url;
216
- return _ts_generator(this, function(_state) {
217
- headers = new Headers();
218
- if (opts.token) headers.append('Authorization', "Bearer ".concat(opts.token));
219
- options = {
220
- credentials: 'include',
221
- headers: headers
222
- };
223
- url = "".concat(_this.endpointUrl, "/").concat(opts.id || '').concat(_this.getQuery(opts.query));
224
- return [
225
- 2,
226
- fetch(url, options).then(handleResponse)
227
- ];
228
- });
229
- })();
230
- }
231
- },
232
- {
233
- key: "post",
234
- value: function post(data) {
235
- var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
236
- var _this = this;
237
- return _async_to_generator(function() {
238
- var headers, body, url;
239
- return _ts_generator(this, function(_state) {
240
- headers = new Headers();
241
- body = JSON.stringify(data);
242
- headers.append('Content-Type', 'application/json');
243
- if (opts.token) headers.append('Authorization', "Bearer ".concat(opts.token));
244
- url = "".concat(_this.endpointUrl).concat(_this.getQuery(opts.query));
245
- return [
246
- 2,
247
- fetch(url, {
248
- method: 'POST',
249
- body: body,
250
- headers: headers,
251
- credentials: 'include'
252
- }).then(handleResponse)
253
- ];
254
- });
255
- })();
256
- }
257
- },
258
- {
259
- key: "put",
260
- value: function put(id, data) {
261
- var opts = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
262
- var _this = this;
263
- return _async_to_generator(function() {
264
- var body, headers, url;
265
- return _ts_generator(this, function(_state) {
266
- body = JSON.stringify(data);
267
- headers = new Headers();
268
- headers.append('Content-Type', 'application/json');
269
- if (opts.token) headers.append('Authorization', "Bearer ".concat(opts.token));
270
- url = "".concat(_this.endpointUrl).concat(opts.noId ? '' : '/').concat(id || '').concat(_this.getQuery(opts.query));
271
- return [
272
- 2,
273
- fetch(url, {
274
- method: 'PUT',
275
- body: body,
276
- headers: headers,
277
- credentials: 'include'
278
- }).then(handleResponse)
279
- ];
280
- });
281
- })();
282
- }
283
- },
284
- {
285
- key: "delete",
286
- value: function _delete(id) {
287
- var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
288
- var _this = this;
289
- return _async_to_generator(function() {
290
- var headers, url;
291
- return _ts_generator(this, function(_state) {
292
- headers = new Headers();
293
- if (opts.token) headers.append('Authorization', "Bearer ".concat(opts.token));
294
- url = "".concat(_this.endpointUrl, "/").concat(id).concat(_this.getQuery(opts.query));
295
- return [
296
- 2,
297
- fetch(url, {
298
- headers: headers,
299
- method: 'DELETE',
300
- credentials: 'include'
301
- }).then(handleResponse)
302
- ];
303
- });
304
- })();
305
- }
306
- },
307
- {
308
- key: "getQuery",
309
- value: function getQuery(query) {
310
- return query ? "?".concat(new URLSearchParams(Query.encode(query)).toString()) : '';
311
- }
312
- }
313
- ]);
314
- return Api;
315
- }();
316
- export { Api as default };