0
getApplications(current_page: number) {
    this.isBusy = true;
    this.applicationDataSource = [];
    this.applicationService.getApplication(current_page).subscribe(response => {
        if (response['data']) {
            this.pagination_meta = response['meta'];
            response['data'].map((value: any, index: any) => {
                var age:any;
                 

 this.applicationService.getAgeFromBirthday(value.order.reservation.customer.birthday)
.subscribe(res=>{
                    age = res;
                })
                let dataSource = {
                    'sample_id': value.order.ilummina_report_id ? 
value.order.ilummina_report_id : '',
                    'date_of_blood_collection': value.date_of_blood_draw ? 
value.date_of_blood_draw : '',
                    'patients_last_name': value.order.reservation.customer.last_name ? 
value.order.reservation.customer.last_name : '',
                    'date_of_birth':value.order.reservation.customer.birthday + age,
                    'patients_first_name': value.order.reservation.customer.first_name ? 
value.order.reservation.customer.first_name : '',
                    'number_of_fetuses': value.pregnancy_type,
                    'number_of_weeks_pregnant': value.patient_gestational_age_weeks + ' 週 ' + 
value.patient_gestational_age_days + ' 日',
                    'test_plan': value.plan_component.plan,
                    'action': value.id,
                    'check_input': '',
                    'meta': value
                }
                this.applicationDataSource.push(dataSource);
                        

On my service this is the API call

    getAgeFromBirthday(birthday: string): Observable<any> {
    return new Observable<any>((observer) => {
        this.http.get(this.appSettings.getApiUrl() + 
apiEndpoints.getAgefromBirthday(birthday), this.appSettings.getHeaders()).subscribe(response 
=> {
            observer.next(response);
            observer.complete();
        }, err => {
            observer.next(false);
            observer.complete();
        })
    })
}

I am getting http 429 . and when I try to console the result , the getAgefrombirthday executed last , that is why age is undefined when render , but later it will show it to console and http 429 error occurs ..

Please help

ace Garcia
  • 11
  • 3
  • Your API is returning a 429. Sounds like it's working as intended -- and if it isn't you haven't shared your backend code at all so we can't do much about it. – Roddy of the Frozen Peas Feb 11 '22 at 03:12
  • public static function get_age_from_birth_day($birthday) { $now = date('Ymd'); $birthday = str_replace('-', '', $birthday); return (string) floor(($now - $birthday) / 10000); } This is the function . – ace Garcia Feb 11 '22 at 03:19

0 Answers0