Stop using multiple apiService instances
This commit is contained in:
parent
7d637e84e4
commit
cf1980d768
8 changed files with 14 additions and 17 deletions
|
@ -19,9 +19,7 @@ export class ApiService {
|
|||
}
|
||||
|
||||
public post(url: string, data: any = {}) {
|
||||
if ( this.sessionKey != null ) {
|
||||
data.session_key = this.sessionKey;
|
||||
}
|
||||
data.session_key = this.sessionKey;
|
||||
return this.http.post(
|
||||
this.apiUrl + url,
|
||||
data
|
||||
|
@ -77,12 +75,18 @@ export class ApiService {
|
|||
public logout() {
|
||||
console.log(this.sessionKey);
|
||||
const key = this.sessionKey;
|
||||
return this.http.post(
|
||||
this.apiUrl + '/logout',
|
||||
{
|
||||
session_key : key,
|
||||
}
|
||||
).map( response => { this.removeSessionKey(); return response.json(); } );
|
||||
return this.http
|
||||
.post(
|
||||
this.apiUrl + '/logout',
|
||||
{ session_key : key },
|
||||
)
|
||||
.map(
|
||||
response => {
|
||||
localStorage.clear();
|
||||
this.sessionKey = null;
|
||||
return response.json();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Submits feedback
|
||||
|
|
Reference in a new issue