import React, { useContext, useState, useEffect } from "react";
// import BlogItem from "../components/Blogs";
import { useSelector } from "react-redux";
import OffersInterest from "../components/OffersInterest";

import usersService from "../services/UsersService";

export default function OffersInterestPage() {
    const apiCall = new usersService()

    let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)

    let [offerInterestList, setOfferInterestList] = useState({loading: true, data: [], imgServer:''})

    useEffect(()=>{
        apiCall.offersInterestList().then(res => {
            setOfferInterestList({loading: false, data: res.data.result_list, imgServer:res.data.session_image_server})
        }).catch(err => {
            setOfferInterestList({loading: false, data: [], imgServer:''})
            console.log('Error: ', err)
        })
    },[])

    return (
        <>
            <OffersInterest  commonHeadData={commonHeadBanner.result_list} offerInterestList={offerInterestList} />
        </>
    );
}