commit ce7423343ae61556ce94cd7276128be20686add8
parent f21f8f7326d8949c01b8e48d0a5c3277f0496a46
Author: MTRNord <mtrnord1@gmail.com>
Date: Tue, 10 Apr 2018 20:49:27 +0200
Set uuid if needed on check (for example after tab got closed)
Diffstat:
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/app/api.service.ts b/src/app/api.service.ts
@@ -63,6 +63,6 @@ export class ApiService {
}
checkIfUserIsAuthenticated(): Observable<any> {
- return this.http.get(`${this.url}/login/twitter/check`);
+ return this.http.get(`${this.url}/login/twitter/check`, { observe: 'response' });
}
}
diff --git a/src/app/navbar/navbar.component.ts b/src/app/navbar/navbar.component.ts
@@ -33,7 +33,12 @@ export class NavbarComponent implements OnInit {
.concat(Observable.throw({error: 'Sorry, there was an error (after 5 retries). This probably means we can\'t reach our API Server :('}));
})
.subscribe(
- data => { this.authenticated = true; },
+ data => {
+ this.authenticated = true;
+ if (!this.apiService.userUUID) {
+ this.apiService.userUUID = data.headers.get('UUID');
+ }
+ },
err => {
if (err['error'] === '401') {
this.authenticated = false;