Commit 6cf7a631 by kashif ansari

sending comment and project in to lead API

1 parent 61d21719
......@@ -10,7 +10,7 @@ const { createCoreService } = require("@strapi/strapi").factories;
module.exports = createCoreService("api::lead.lead", ({ strapi: Strapi }) => ({
async sendLeadToSperto(data) {
console.log(data);
const headers = { "Content-Type": "application/json" };
const leadData = {
api_key: process.env.SPERTO_API_KEY,
......@@ -20,14 +20,27 @@ module.exports = createCoreService("api::lead.lead", ({ strapi: Strapi }) => ({
mobile1_isd: "",
mobile_no1: data.mobileNumber,
email_id1: data.email,
otp_verified_yn: "N",
};
console.log(leadData);
if (data.comments) {
leadData.comments = data.comments;
}
if (data?.project) {
const projectData = await strapi.db
.query("api::project.project")
.findOne({
where: {
id: data?.project,
},
});
leadData.project_name = projectData.projectName;
}
const abc = await axios.post(
const spertoResponse = await axios.post(
"https://net4hgc.sperto.co.in/_api/api_auth_post_lead_json.php",
leadData,
{ headers: headers }
);
return abc;
return spertoResponse;
},
}));
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!