Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
strapi-setup-file
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 6cf7a631
authored
2022-11-04 15:35:40 +0530
by
kashif ansari
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sending comment and project in to lead API
1 parent
61d21719
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
src/api/lead/services/lead.js
src/api/lead/services/lead.js
View file @
6cf7a63
...
...
@@ -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
;
},
}));
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment