Skip to content

Instantly share code, notes, and snippets.

@arturovt
Created May 21, 2019 18:53
Show Gist options
  • Save arturovt/4c5cddb5742a5ebe5ab705e89b9df3ec to your computer and use it in GitHub Desktop.
Save arturovt/4c5cddb5742a5ebe5ab705e89b9df3ec to your computer and use it in GitHub Desktop.
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient, private store: Store) {}
public getUser() {
const { id } = this.store.selectSnapshot<UserStateModel>(UserState);
return this.http.get(`${environment.apiUrl}/users/${id}`);
}
public getLoginHistory() {
const { id } = this.store.selectSnapshot<UserStateModel>(UserState);
return this.http.get(`${environment.apiUrl}/users/login-history/${id}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment