import axios from "axios";

export const formService =
{
  // Propriété qui stocke la BASE URL de notre API
	//base_url : "http://192.168.42.124/projets_wordpress/BOPortfolio/wordpress/wp-json/",
	//base_url : "http://192.168.1.41/projets_wordpress/BOPortfolio/wordpress/wp-json/",
	base_url : "https://bo-portfolio.raffiskender.com/wp-json/",
	//base_url : "http://localhost/projets_wordpress/BOPortfolio/wordpress/wp-json/",
  
  // Retrieve data from backend
  async sendMessage(token, payload)
	{
    //console.log(token, payload);
    
    
    
    const response = await axios.post(
			this.base_url + "bo-portfolio/v1/submitForm",
			{
        token: token,
        json: payload
			},
			
    ).catch( function() {
      return { data : null };
    });
    return response.data;
  },
}

// async verifyRecaptcha(token){


//   return fetch(VERIFY_URL, {
//     method: "POST",
//     headers: { "Content-Type": "application/x-www-form-urlencoded" },
//     body: `secret=${SECRET_KEY}&response=${req.body['g-recaptcha-response']}`,
//   })
// },