20 lines
576 B
TypeScript
20 lines
576 B
TypeScript
import {Injectable} from '@angular/core';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {Observable} from 'rxjs';
|
|
import {IFeed} from '../interfaces/feed.interface';
|
|
import {delay} from 'rxjs/operators';
|
|
import {environment} from '../../environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class FeedService {
|
|
private url = 'http://' + environment.location + ':' + environment.port + '/feeds/';
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
getFeeds(): Observable<IFeed[]> {
|
|
return this.http.get<IFeed[]>(this.url).pipe(delay(200));
|
|
}
|
|
}
|