Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

Commit 6c45c9f

Browse files
authored
Merge pull request #394 from miguelgrc/raw_json_data
Use raw json data for editor
2 parents f2c94fe + 61766e7 commit 6c45c9f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/app/core/services/common-api.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222

2323
import { Injectable } from '@angular/core';
24-
import { Http } from '@angular/http';
24+
import { Http, Headers } from '@angular/http';
2525

2626
import { Observable } from 'rxjs/Observable';
2727

@@ -35,8 +35,8 @@ export class CommonApiService {
3535

3636
constructor(protected http: Http) { }
3737

38-
fetchUrl(url: string): Promise<Object> {
39-
return this.http.get(url)
38+
fetchUrl(url: string, options?: Object): Promise<Object> {
39+
return this.http.get(url, options)
4040
.map(res => res.json())
4141
.toPromise();
4242
}

src/app/core/services/record-api.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export class RecordApiService extends CommonApiService {
3939
private currentRecordId: string;
4040

4141
private readonly returnOnlyIdsHeaders = new Headers({ Accept: 'application/vnd+inspire.ids+json' });
42+
private readonly rawJsonDataHeaders = new Headers({ Accept: 'application/vnd+inspire.record.raw+json' });
4243

4344
readonly newRecordFetched$ = new ReplaySubject<void>(1);
4445

@@ -58,7 +59,7 @@ export class RecordApiService extends CommonApiService {
5859
this.currentRecordApiUrl = `${apiUrl}/${pidType}/${pidValue}`;
5960
this.currentRecordEditorApiUrl = `${editorApiUrl}/${pidType}/${pidValue}`;
6061
this.newRecordFetched$.next(null);
61-
return this.fetchUrl(this.currentRecordApiUrl);
62+
return this.fetchUrl(this.currentRecordApiUrl, { headers: this.rawJsonDataHeaders });
6263
}
6364

6465
saveRecord(record: object): Observable<void> {

0 commit comments

Comments
 (0)