import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { map } from 'rxjs/operators' ; import { HttpParams } from '@angular/common/http' ; import { ApiCallService , ApiService , httpObserveOptions } from '../../services/api-call.service' ; @ Injectable ( { providedIn : 'root' } ) export class DateSettingsService < T = any > implements ApiService { public readonly servicePrefix : string = 'date' ; /**
     * The current date settings.
     */ public currentDateSettings$ : any ; constructor ( private api ) { this . getDateSettings ( ) . subscribe ( ( ) => { } ) ; } public get currentDateSettings ( ) { return this . currentDateSettings$ ; } public set currentDateSettings ( value ) { this . currentDateSettings$ = value ; } public getDateSettings ( ) { return this . api . callGet < T > ( `${ this . servicePrefix }/` ) . pipe ( map ( ( apiResponse ) => { this . currentDateSettings = apiResponse . body ; return apiResponse . body ; } ) ) ; } public postDateSettings ( data ) { const options = httpObserveOptions ; options . params = new HttpParams ( ) ; return this . api . callPost < T > ( `${ this . servicePrefix }/` , data , options ) . pipe ( map ( ( apiResponse ) => { this . currentDateSettings = apiResponse . body ; return apiResponse . body ; } ) ) ; } }