brainloper-ui 14.1.9 → 14.1.11
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/esm2020/src/app/modules/services/http.service.mjs +52 -38
- package/fesm2015/brainloper-ui.mjs +51 -37
- package/fesm2015/brainloper-ui.mjs.map +1 -1
- package/fesm2020/brainloper-ui.mjs +51 -37
- package/fesm2020/brainloper-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/modules/services/http.service.d.ts +17 -8
|
@@ -316,7 +316,7 @@ class HttpService {
|
|
|
316
316
|
}
|
|
317
317
|
return data;
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
createOptionsWithResponseType(params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
320
320
|
const options = {
|
|
321
321
|
params: this.createParams(params),
|
|
322
322
|
withCredentials
|
|
@@ -324,56 +324,38 @@ class HttpService {
|
|
|
324
324
|
if (responseType !== HttpResponseType.JSON) {
|
|
325
325
|
options.responseType = responseType;
|
|
326
326
|
}
|
|
327
|
-
return
|
|
327
|
+
return options;
|
|
328
328
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
params: this.createParams(params),
|
|
332
|
-
withCredentials
|
|
333
|
-
};
|
|
334
|
-
if (responseType !== HttpResponseType.JSON) {
|
|
335
|
-
options.responseType = responseType;
|
|
336
|
-
}
|
|
337
|
-
return this.http.post(url, body, options);
|
|
329
|
+
getData(url, params, withCredentials = false) {
|
|
330
|
+
return this.http.get(url, { params: this.createParams(params), withCredentials });
|
|
338
331
|
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
params: this.createParams(params),
|
|
342
|
-
withCredentials
|
|
343
|
-
};
|
|
344
|
-
if (responseType !== HttpResponseType.JSON) {
|
|
345
|
-
options.responseType = responseType;
|
|
346
|
-
}
|
|
347
|
-
return this.http.put(url, body, options);
|
|
332
|
+
postData(url, body, params, withCredentials = false) {
|
|
333
|
+
return this.http.post(url, body, { params: this.createParams(params), withCredentials });
|
|
348
334
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
};
|
|
354
|
-
if (responseType !== HttpResponseType.JSON) {
|
|
355
|
-
options.responseType = responseType;
|
|
356
|
-
}
|
|
357
|
-
return this.http.delete(url, options);
|
|
335
|
+
putData(url, body, params, withCredentials = false) {
|
|
336
|
+
return this.http.put(url, body, { params: this.createParams(params), withCredentials });
|
|
337
|
+
}
|
|
338
|
+
deleteData(url, params, withCredentials = false) {
|
|
339
|
+
return this.http.delete(url, { params: this.createParams(params), withCredentials });
|
|
358
340
|
}
|
|
359
|
-
getDataPromise(url, params, withCredentials = false
|
|
341
|
+
getDataPromise(url, params, withCredentials = false) {
|
|
360
342
|
return new Promise((resolve, reject) => {
|
|
361
|
-
this.getData(url, params, withCredentials
|
|
343
|
+
this.getData(url, params, withCredentials).subscribe(res => resolve(res), err => reject(err));
|
|
362
344
|
});
|
|
363
345
|
}
|
|
364
|
-
postDataPromise(url, body, params, withCredentials = false
|
|
346
|
+
postDataPromise(url, body, params, withCredentials = false) {
|
|
365
347
|
return new Promise((resolve, reject) => {
|
|
366
|
-
this.postData(url, body, params, withCredentials
|
|
348
|
+
this.postData(url, body, params, withCredentials).subscribe(res => resolve(res), err => reject(err));
|
|
367
349
|
});
|
|
368
350
|
}
|
|
369
|
-
putDataPromise(url, body, params, withCredentials = false
|
|
351
|
+
putDataPromise(url, body, params, withCredentials = false) {
|
|
370
352
|
return new Promise((resolve, reject) => {
|
|
371
|
-
this.putData(url, body, params, withCredentials
|
|
353
|
+
this.putData(url, body, params, withCredentials).subscribe(res => resolve(res), err => reject(err));
|
|
372
354
|
});
|
|
373
355
|
}
|
|
374
|
-
deleteDataPromise(url, params, withCredentials = false
|
|
356
|
+
deleteDataPromise(url, params, withCredentials = false) {
|
|
375
357
|
return new Promise((resolve, reject) => {
|
|
376
|
-
this.deleteData(url, params, withCredentials
|
|
358
|
+
this.deleteData(url, params, withCredentials).subscribe(res => resolve(res), err => reject(err));
|
|
377
359
|
});
|
|
378
360
|
}
|
|
379
361
|
getDataBody(url, params, withCredentials = false) {
|
|
@@ -415,6 +397,38 @@ class HttpService {
|
|
|
415
397
|
}, err => reject(err));
|
|
416
398
|
});
|
|
417
399
|
}
|
|
400
|
+
getDataWithResponseType(url, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
401
|
+
return this.http.get(url, this.createOptionsWithResponseType(params, withCredentials, responseType));
|
|
402
|
+
}
|
|
403
|
+
postDataWithResponseType(url, body, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
404
|
+
return this.http.post(url, body, this.createOptionsWithResponseType(params, withCredentials, responseType));
|
|
405
|
+
}
|
|
406
|
+
putDataWithResponseType(url, body, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
407
|
+
return this.http.put(url, body, this.createOptionsWithResponseType(params, withCredentials, responseType));
|
|
408
|
+
}
|
|
409
|
+
deleteDataWithResponseType(url, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
410
|
+
return this.http.delete(url, this.createOptionsWithResponseType(params, withCredentials, responseType));
|
|
411
|
+
}
|
|
412
|
+
getDataPromiseWithResponseType(url, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
413
|
+
return new Promise((resolve, reject) => {
|
|
414
|
+
this.getDataWithResponseType(url, params, withCredentials, responseType).subscribe(res => resolve(res), err => reject(err));
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
postDataPromiseWithResponseType(url, body, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
418
|
+
return new Promise((resolve, reject) => {
|
|
419
|
+
this.postDataWithResponseType(url, body, params, withCredentials, responseType).subscribe(res => resolve(res), err => reject(err));
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
putDataPromiseWithResponseType(url, body, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
423
|
+
return new Promise((resolve, reject) => {
|
|
424
|
+
this.putDataWithResponseType(url, body, params, withCredentials, responseType).subscribe(res => resolve(res), err => reject(err));
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
deleteDataPromiseWithResponseType(url, params, withCredentials = false, responseType = HttpResponseType.JSON) {
|
|
428
|
+
return new Promise((resolve, reject) => {
|
|
429
|
+
this.deleteDataWithResponseType(url, params, withCredentials, responseType).subscribe(res => resolve(res), err => reject(err));
|
|
430
|
+
});
|
|
431
|
+
}
|
|
418
432
|
}
|
|
419
433
|
HttpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpService, deps: [{ token: i1$1.HttpClient }, { token: MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
420
434
|
HttpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HttpService });
|