import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {environment} from '../../environments/environment';
import {Observable} from 'rxjs';

@Injectable()
export class RestService {
  private currentLocation = 'http://' + environment.location + ':' + environment.port + '/';

  constructor(
    private logger: NGXLogger,
    private http: HttpClient
  ) {
  }

  testCall(i: number): Observable<string> {
    const url = this.currentLocation + 'test/';
    this.logger.debug('Performing ' + i + '. test rest call on', url);
    return this.http.get<string>(url);
  }
}
