socialnetworknews-web

A open-source Paper.li clone
git clone git://archive.git.mtrnord.blog/SocialNetworkNews/socialnetworknews-web.git
Log | Files | Refs | README | LICENSE

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:
Msrc/app/api.service.ts | 2+-
Msrc/app/navbar/navbar.component.ts | 7++++++-
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;