@mtgame/core 0.0.72 → 0.0.74

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/api/file-api.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare class FileApi {
5
5
  private httpClient;
6
6
  private configService;
7
7
  constructor(httpClient: HttpClient, configService: ConfigService);
8
- upload(fileData: any, filename?: string): Promise<File>;
8
+ upload(fileData: any, filename?: string, width?: number, height?: number): Promise<File>;
9
9
  createZipArchive(files: {
10
10
  file: any;
11
11
  filename: string;
@@ -2803,14 +2803,18 @@
2803
2803
  this.httpClient = httpClient;
2804
2804
  this.configService = configService;
2805
2805
  }
2806
- FileApi.prototype.upload = function (fileData, filename) {
2806
+ FileApi.prototype.upload = function (fileData, filename, width, height) {
2807
2807
  return __awaiter(this, void 0, void 0, function () {
2808
- var formData;
2808
+ var params, formData;
2809
2809
  return __generator(this, function (_a) {
2810
+ params = new http.HttpParams();
2811
+ if (width && height) {
2812
+ params.set('width', width.toString()).set('height', height.toString());
2813
+ }
2810
2814
  formData = new FormData();
2811
2815
  formData.append('file', fileData, filename);
2812
2816
  return [2 /*return*/, this.httpClient
2813
- .post(this.configService.get('apiUrl') + "/api/v1/file/", formData)
2817
+ .post(this.configService.get('apiUrl') + "/api/v1/file/", formData, { params: params })
2814
2818
  .pipe(operators.map(function (data) { return File.toFront(data); }))
2815
2819
  .toPromise()];
2816
2820
  });
@@ -8607,8 +8611,9 @@
8607
8611
  }
8608
8612
 
8609
8613
  var HttpCookieInterceptor = /** @class */ (function () {
8610
- function HttpCookieInterceptor(injector, platformId) {
8614
+ function HttpCookieInterceptor(injector, configService, platformId) {
8611
8615
  this.injector = injector;
8616
+ this.configService = configService;
8612
8617
  this.platformId = platformId;
8613
8618
  this.isBrowser = common.isPlatformBrowser(this.platformId);
8614
8619
  }
@@ -8616,7 +8621,8 @@
8616
8621
  if (!this.isBrowser) {
8617
8622
  return next.handle(req);
8618
8623
  }
8619
- if (req.withCredentials !== false) {
8624
+ var apiUrl = this.configService.get('apiUrl');
8625
+ if (apiUrl === req.url.substr(0, apiUrl.length)) {
8620
8626
  req = req.clone({ withCredentials: true });
8621
8627
  }
8622
8628
  var csrf = getCookie('csrftoken');
@@ -8629,11 +8635,12 @@
8629
8635
  };
8630
8636
  HttpCookieInterceptor.ctorParameters = function () { return [
8631
8637
  { type: core.Injector },
8638
+ { type: ConfigService },
8632
8639
  { type: String, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] }
8633
8640
  ]; };
8634
8641
  HttpCookieInterceptor = __decorate([
8635
8642
  core.Injectable(),
8636
- __param(1, core.Inject(core.PLATFORM_ID))
8643
+ __param(2, core.Inject(core.PLATFORM_ID))
8637
8644
  ], HttpCookieInterceptor);
8638
8645
  return HttpCookieInterceptor;
8639
8646
  }());