fix: expect api requests to return json (#473)
This commit is contained in:
parent
15b446b878
commit
7593cadd40
1 changed files with 13 additions and 6 deletions
|
|
@ -22,14 +22,21 @@ export class ApiService {
|
||||||
this.node.setLoading();
|
this.node.setLoading();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let header;
|
let options: any = {
|
||||||
|
responseType: 'json',
|
||||||
|
};
|
||||||
if (this.appSettings.settings.serverAuth != null && this.appSettings.settings.serverAuth !== '') {
|
if (this.appSettings.settings.serverAuth != null && this.appSettings.settings.serverAuth !== '') {
|
||||||
header = {
|
options =
|
||||||
headers: new HttpHeaders()
|
Object.assign(
|
||||||
.set('Authorization', this.appSettings.settings.serverAuth)
|
{},
|
||||||
};
|
options,
|
||||||
|
{
|
||||||
|
headers: new HttpHeaders()
|
||||||
|
.set('Authorization', this.appSettings.settings.serverAuth)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return await this.http.post(apiUrl, data, header).toPromise()
|
return await this.http.post(apiUrl, data, options).toPromise()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.node.setOnline();
|
this.node.setOnline();
|
||||||
return res;
|
return res;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue