Skip to content

Instantly share code, notes, and snippets.

@arturovt
Created May 21, 2019 19:04
Show Gist options
  • Save arturovt/c66962bb0208f84ad91e1954a8cb82b4 to your computer and use it in GitHub Desktop.
Save arturovt/c66962bb0208f84ad91e1954a8cb82b4 to your computer and use it in GitHub Desktop.
import { SelectSnapshot } from '@ngxs-labs/select-snapshot';
@Injectable({ providedIn: 'root' })
export class UserService {
@SelectSnapshot(UserState.getUserId)
public id: number;
constructor(private http: HttpClient) {}
public getUser() {
return this.http.get(`${environment.apiUrl}/users/${this.id}`);
}
public getLoginHistory() {
return this.http.get(`${environment.apiUrl}/users/login-history/${this.id}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment