mirror of
https://github.com/oceanprotocol/webtasks
synced 2025-01-06 20:05:40 +01:00
fix exisiting users detection
This commit is contained in:
parent
b9cd283ab6
commit
bac7e7c694
@ -78,10 +78,12 @@ server.post('/newsletter/:email', (req, res) => {
|
||||
request.get(baseOptions, (error, response, body) => {
|
||||
if (error) res.send(error)
|
||||
|
||||
const data = JSON.parse(body)
|
||||
|
||||
// Member exists and is subscribed
|
||||
if (body.status === 'subscribed') {
|
||||
if (data.status === 'subscribed') {
|
||||
// Patch in native GDPR permissions
|
||||
addMarketingPermissions(body, () => {
|
||||
addMarketingPermissions(data, () => {
|
||||
res.send('{ "status": "exists" }')
|
||||
})
|
||||
} else {
|
||||
@ -89,12 +91,14 @@ server.post('/newsletter/:email', (req, res) => {
|
||||
request.put(optionsCreate, (error2, response, body2) => {
|
||||
if (error2) res.send(error2)
|
||||
|
||||
if (Number.isInteger(body2.status)) {
|
||||
const data2 = JSON.parse(body2)
|
||||
|
||||
if (Number.isInteger(data2.status)) {
|
||||
res.send(body2)
|
||||
}
|
||||
|
||||
// Patch in native GDPR permissions
|
||||
addMarketingPermissions(body2, () => {
|
||||
addMarketingPermissions(data2, () => {
|
||||
res.send('{ "status": "created" }')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user