import { Injectable } from '@angular/core';
import {SessionDataProviderService} from "./session-data-provider.service";
import {WrenchService} from "../services/wrench.service";

@Injectable({
  providedIn: 'root'
})
export class FamilysuggestPendingService {

  constructor(
      public sessionDataProviderService: SessionDataProviderService,
      private wrenchService: WrenchService
  ) {
    //this.getFamilyPeningData();
  }

  usrData: {
    action:number, member_id: number, uid: string, sessionid: string, limit:20, page:1,offset: 0
  };
  suggestionTotal:number = 0;
  familyPendingTotalData:any;
  familyPendingData: [];
  async getFamilyPeningData(){
    this.usrData = {action:22010,
      member_id: this.sessionDataProviderService.member_id,
      uid: this.sessionDataProviderService.member_uid,
      sessionid: this.sessionDataProviderService.session ,
      limit:20, page:1,offset: 0}

    this.wrenchService.getFamilyPeningList(this.usrData).subscribe(
        familyPendingTotalData => {
          this.familyPendingTotalData = familyPendingTotalData;
          console.log("familyPendingTotalData  RETURN->", this.familyPendingTotalData);
          this.familyPendingData = this.familyPendingTotalData.result_list;
          // debugger;
          console.log("FAMILY familyPendingData DATA->", this.familyPendingData);
          this.suggestionTotal = this.familyPendingData.length;
        }
    );

  }
}
