|
1 | 1 | import { Injectable } from '@angular/core'; |
2 | 2 | import { ProjectService } from './projectService'; |
3 | 3 | import { ConfigService } from './configService'; |
4 | | -import { HttpClient, HttpHeaders } from '@angular/common/http'; |
| 4 | +import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; |
5 | 5 | import { Observable, Subject } from 'rxjs'; |
6 | 6 | import { generateRandomKey } from '../common/string/string'; |
7 | 7 | import { Annotation } from '../common/Annotation'; |
@@ -121,15 +121,13 @@ export class AnnotationService { |
121 | 121 | let annotation = this.saveToServerSuccess(savedAnnotationDataResponse); |
122 | 122 | return Promise.resolve(annotation); |
123 | 123 | } else { |
124 | | - const params = { |
125 | | - runId: this.configService.getRunId(), |
126 | | - workgroupId: this.configService.getWorkgroupId(), |
127 | | - annotations: JSON.stringify(annotations) |
128 | | - }; |
129 | | - const headers = new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }); |
| 124 | + const body = new HttpParams() |
| 125 | + .set('runId', this.configService.getRunId()) |
| 126 | + .set('workgroupId', this.configService.getWorkgroupId()) |
| 127 | + .set('annotations', JSON.stringify(annotations)); |
130 | 128 | return this.http |
131 | | - .post(this.configService.getConfigParam('teacherDataURL'), $.param(params), { |
132 | | - headers: headers |
| 129 | + .post(this.configService.getConfigParam('teacherDataURL'), body, { |
| 130 | + headers: new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }) |
133 | 131 | }) |
134 | 132 | .toPromise() |
135 | 133 | .then((savedAnnotationDataResponse: any) => { |
|
0 commit comments