Closed 1cookspe closed 2 years ago
Hi @1cookspe
request
module in javascript looks fine to me. In case you still face the issue try using axios module, it works pretty well and is not deprecated, unlike the request
module.let
or const
instead of var
.Regarding this error:
TypeError: Failed to fetch Have a look at this thread, it might help.
Happy to help!
Closing this thread since there is no activity on this thread for more than 15 days.
I am trying to implement the Sendinblue API in my React JS application. I have a text input that the user is to enter their email into, and then a button that will add their email to a Sendinblue list. I am using the "Create a contact" reference located here in Node.js, as I am using the JavaScript code for my React app. Sometimes, this code works, as the email is successfully added to the SendinBlue list, however most times the email is not added and I receive the following error:
var request = require("request");
My full code is seen below:
When I test this on the Sendinblue API docs, it successfully adds the email to my contact list every time. I test it with a new email each time to ensure that it does not throw an error because of a duplicate email. I have also tinkered with the value of
updateEnabled
betweentrue
andfalse
however it does not seem to help solve this issue.I believe that the error may stem from the
var request = require("request");
command in the first line, as I am not sure ifrequire
is a React method or a Node.js method.If anyone has any ideas on how I could fix this, your help would be greatly appreciated. Thank you.