2019-12-17 11:44:59 +09:00
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { map } from 'rxjs/operators';
|
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
|
2019-12-19 18:08:16 +09:00
|
|
|
import {
|
|
|
|
decodeMailCount,
|
|
|
|
MailCountResponse,
|
|
|
|
decodePaymentCount,
|
|
|
|
PaymentCountResponse
|
|
|
|
} from '../apis/api';
|
2019-12-17 11:44:59 +09:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: 'root'
|
|
|
|
})
|
|
|
|
export class DaesangApiService {
|
|
|
|
constructor(private httpClient: HttpClient) {}
|
|
|
|
|
|
|
|
public retrieveMailCount(url: string): Observable<MailCountResponse> {
|
|
|
|
return this.httpClient
|
|
|
|
.post<any>(url, {}, {})
|
|
|
|
.pipe(map(res => decodeMailCount(res)));
|
|
|
|
}
|
|
|
|
|
2019-12-19 18:08:16 +09:00
|
|
|
public retrievePaymentCount(url: string): Observable<PaymentCountResponse> {
|
2019-12-17 11:44:59 +09:00
|
|
|
return this.httpClient
|
|
|
|
.post<any>(url, {}, {})
|
2019-12-19 18:08:16 +09:00
|
|
|
.pipe(map(res => decodePaymentCount(res)));
|
2019-12-17 11:44:59 +09:00
|
|
|
}
|
|
|
|
}
|