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

@Injectable({
  providedIn: 'root'
})
export class BannersDataService {
  homebannerCount:number=0;
  constructor(    public sessionDataProviderService: SessionDataProviderService,
                  private wrenchService: WrenchService) { }
  bannerResult:any;
  bannerData: [];
  usrData: {
    action:number, member_id: number, uid: string,
    sessionid: string,
    'limit': 30,
    'offset': 0
  };
  async getBannersData(){
    this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid,
      sessionid: this.sessionDataProviderService.session,'limit': 30,
      'offset': 0 }
    this.wrenchService.getHomeBanners(this.usrData).subscribe(
        bannerResult => {
          this.bannerResult = bannerResult;
          console.log("BANNERS RETURN->", this.bannerResult);
          this.bannerData = this.bannerResult.result_list;
          this.homebannerCount = this.bannerData.length;
          // debugger;
          console.log("BANNERS RETURN DATA->", this.bannerData);
          //  this.blogDataService.setBlogData(this.blogResult.blog_data);
        }
    );
  }

}
