Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(emptyuser): fixes creation logic for empty observable or cached user
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutride authored and joshuawilson committed Mar 7, 2017
1 parent 694a4dd commit d349552
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class UserService {
// We need the auth key to get the user data. So either we already the data or we don't have the keys
// in either case don't try to get the data.
if (Object.keys(this.userData).length || !this.auth.isLoggedIn()) {
return Observable.create(this.userData);
return Observable.of(this.userData);
} else {
return this.http
.get(this.userUrl, {headers: this.headers})
Expand Down Expand Up @@ -91,7 +91,7 @@ export class UserService {
*/
getAllUsers(): Observable<User[]> {
if (this.allUserData.length) {
return Observable.create(this.allUserData);
return Observable.of(this.allUserData);
} else {
return this.http
.get(this.usersUrl, {headers: this.headers})
Expand Down

0 comments on commit d349552

Please sign in to comment.