Fixed bug where HTTP headers were sent when params should have been sent instead

sessionID now gets sent after logging in
pull/67/head
Isaac Grynsztein 6 years ago
parent 98f1d003c3
commit e6ea2238f8

@ -59,7 +59,7 @@ export class PostsService implements CanActivate {
this.token = localStorage.getItem('jwt_token'); this.token = localStorage.getItem('jwt_token');
this.httpOptions = { this.httpOptions = {
params: new HttpParams({ params: new HttpParams({
fromString: `apiKey=${this.auth_token}&jwt=${this.token}` fromString: `apiKey=${this.auth_token}&sessionID=${this.session_id}&jwt=${this.token}`
}), }),
}; };
this.jwtAuth(); this.jwtAuth();
@ -170,11 +170,11 @@ export class PostsService implements CanActivate {
subscriptionName: subscriptionName, subscriptionName: subscriptionName,
subPlaylist: subPlaylist subPlaylist: subPlaylist
}, },
{responseType: 'blob', headers: this.httpOptions.headers}); {responseType: 'blob', params: this.httpOptions.params});
} }
downloadArchive(sub) { downloadArchive(sub) {
return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob', headers: this.httpOptions.headers}); return this.http.post(this.path + 'downloadArchive', {sub: sub}, {responseType: 'blob', params: this.httpOptions.params});
} }
getFileInfo(fileNames, type, urlMode) { getFileInfo(fileNames, type, urlMode) {
@ -292,7 +292,7 @@ export class PostsService implements CanActivate {
this.httpOptions = { this.httpOptions = {
params: new HttpParams({ params: new HttpParams({
fromString: `apiKey=${this.auth_token}&jwt=${this.token}` fromString: `apiKey=${this.auth_token}&sessionID=${this.session_id}&jwt=${this.token}`
}), }),
}; };
@ -331,6 +331,18 @@ export class PostsService implements CanActivate {
this.user = null; this.user = null;
this.isLoggedIn = false; this.isLoggedIn = false;
localStorage.setItem('jwt_token', null); localStorage.setItem('jwt_token', null);
if (this.router.url !== '/login') {
this.router.navigate(['/login']);
}
// resets http params
this.http_params = `apiKey=${this.auth_token}&sessionID=${this.session_id}`
this.httpOptions = {
params: new HttpParams({
fromString: this.http_params
}),
};
} }
// user methods // user methods

Loading…
Cancel
Save