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

@Injectable({
  providedIn: 'root'
})
export class MarketDataService {
    session_image_server:string='';
    curr_session:string='';
  constructor( public sessionDataProviderService: SessionDataProviderService,
               private wrenchService: WrenchService) { }

  usrData: {
    action:11200, member_id: number, uid: string, sessionid: string, limit:20, page:1
  };

  jobsTotalData:any;
  jobsData: [];
  getJobsData(){
    this.curr_session =  this.sessionDataProviderService.session;

    this.usrData = {action:11200, member_id: this.sessionDataProviderService.member_id, uid: this.sessionDataProviderService.member_uid, sessionid: this.sessionDataProviderService.session , limit:20, page:1}
    this.wrenchService.getJobsData(this.usrData).subscribe(
        jobsTotalData => {
          this.jobsTotalData = jobsTotalData;
          console.log("PAH HX RETURN->", this.jobsTotalData);
          this.jobsData = this.jobsTotalData.result_list;
          this.session_image_server = this.jobsTotalData.session_image_server;

          // debugger;
          console.log("JOBS RETURN DATA->", this.jobsData);
          //  this.blogDataService.setBlogData(this.blogResult.blog_data);
        }
    );

  }
}
