We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 6477bc3 + 5f64b39 commit 85d234fCopy full SHA for 85d234f
src/app/core/services/user.service.ts
@@ -26,11 +26,13 @@ export class UserService {
26
// This runs once on application startup.
27
populate() {
28
// If JWT detected, attempt to get & store user's info
29
- if (this.jwtService.getToken()) {
30
- this.apiService.get('/user')
31
- .subscribe(
32
- data => this.setAuth(data.user),
33
- err => this.purgeAuth()
+ const token = this.jwtService.getToken();
+ if (token) {
+ this.apiService.get("/user").subscribe(
+ (data) => {
+ return this.setAuth({ ...data.user, token });
34
+ },
35
+ (err) => this.purgeAuth()
36
);
37
} else {
38
// Remove any potential remnants of previous auth states
0 commit comments