26 lines
656 B
TypeScript
26 lines
656 B
TypeScript
import { HttpClient } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs/internal/Observable';
|
|
import { catchError } from 'rxjs/operators';
|
|
|
|
import { ErrorLoggerService } from './error-logger.service';
|
|
|
|
const url = '/api/title';
|
|
const serviceName = 'VoucherService';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class TitleService {
|
|
constructor(
|
|
private http: HttpClient,
|
|
private log: ErrorLoggerService,
|
|
) {}
|
|
|
|
get(): Observable<string> {
|
|
return this.http
|
|
.get<string>(url)
|
|
.pipe(catchError(this.log.handleError(serviceName, 'Get Title'))) as Observable<string>;
|
|
}
|
|
}
|