mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Updated Feed Enpoint Token to string | Observable<string>
This commit is contained in:
@@ -2,14 +2,26 @@ import { Injectable, Inject } from '@angular/core';
|
||||
import { FEED_SERVICE_ENDPOINT } from './tokens';
|
||||
import { PagedApiResponse } from './response';
|
||||
import { FeedDTO } from './dtos/feed.dto';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Observable, isObservable } from 'rxjs';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { StringDictionary } from './models';
|
||||
import { isNumber } from 'util';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class FeedService {
|
||||
constructor(@Inject(FEED_SERVICE_ENDPOINT) private endpoint: string, private http: HttpClient) { }
|
||||
|
||||
endpoint = '';
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
@Inject(FEED_SERVICE_ENDPOINT) endpoint: string | Observable<string>
|
||||
) {
|
||||
if (isObservable(endpoint)) {
|
||||
endpoint.subscribe(e => this.endpoint = e);
|
||||
} else {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
info(options?: { skip?: number; take?: number; }): Observable<PagedApiResponse<FeedDTO>> {
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export const FEED_SERVICE_ENDPOINT = new InjectionToken<string>('feed:service:endpoint');
|
||||
export const FEED_SERVICE_ENDPOINT = new InjectionToken<string | Observable<string>>('feed:service:endpoint');
|
||||
|
||||
Reference in New Issue
Block a user