Skip to content

Commit f899369

Browse files
Replace jquery with angular equivalent
1 parent beb0287 commit f899369

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/assets/wise5/services/annotationService.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { ProjectService } from './projectService';
33
import { ConfigService } from './configService';
4-
import { HttpClient, HttpHeaders } from '@angular/common/http';
4+
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
55
import { Observable, Subject } from 'rxjs';
66
import { generateRandomKey } from '../common/string/string';
77
import { Annotation } from '../common/Annotation';
@@ -121,15 +121,13 @@ export class AnnotationService {
121121
let annotation = this.saveToServerSuccess(savedAnnotationDataResponse);
122122
return Promise.resolve(annotation);
123123
} 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));
130128
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' })
133131
})
134132
.toPromise()
135133
.then((savedAnnotationDataResponse: any) => {

0 commit comments

Comments
 (0)