Last active
May 21, 2019 18:58
-
-
Save arturovt/74d4ac7de856222a1f101cebffb63e05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable({ providedIn: 'root' }) | |
export class UserService { | |
private id = this.store.selectSnapshot<UserStateModel>(UserState).id; | |
constructor(private http: HttpClient, private store: Store) {} | |
public getUser() { | |
return this.http.get(`${environment.apiUrl}/users/${this.id}`); | |
} | |
public getLoginHistory() { | |
const id = this.getUserId(); | |
return this.http.get(`${environment.apiUrl}/users/login-history/${id}`); | |
} | |
private getUserId() { | |
return this.store.selectSnapshot<UserStateModel>(UserState).id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment