Still in progress
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {catchError} from 'rxjs/operators';
|
||||
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
|
||||
import {GuestBook} from './guest-book';
|
||||
import {ErrorLoggerService} from '../core/error-logger.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { GuestBook, GuestBookList } from './guest-book';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
@ -26,10 +26,10 @@ export class GuestBookService {
|
||||
);
|
||||
}
|
||||
|
||||
list(date: string): Observable<GuestBook[]> {
|
||||
list(date: string): Observable<GuestBookList> {
|
||||
const options = {params: new HttpParams().set('q', (date === null) ? '' : date)};
|
||||
const listUrl: string = `${url}/list`;
|
||||
return <Observable<GuestBook[]>>this.http.get<GuestBook[]>(listUrl, options)
|
||||
return <Observable<GuestBookList>>this.http.get<GuestBookList>(listUrl, options)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'list'))
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user