0
I need to register for course instructors, in which each instructor will have a course. How do I?
I’m doing it this way and it’s not going:
PS.: the variable name and email receive a variable in String
, already the variable course receives the object course.
Code:
cadastraInstrutor(name, email, curso) {
return fetch('http://localhost:3001/instrutores/',{
method: "POST",
body: {name: name, email: email, curso: curso},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
})
}
After calling the function registerInstrutor, it gives me the error:
Typeerror: Cannot read Property '1' of Undefined
specifically when trying to save the variable stroke
Is it the same question https://answall.com/questions/321765 ? Or a different question?
– NoobSaibot
I’m already able to register the course, but the instructor needs, in their definitions have the course object. I’m not sure how to do this.
– Emerson Barbosa
It’s returning me this error: Typeerror: Cannot read Property '1' of Undefined
– Emerson Barbosa
In the documentation of MDN has some examples ... But it would be good to ask the question when this error is returning, because apparently you are trying to access the return.
– NoobSaibot
How is your server?
– Sorack
body: JSON.stringify({...}),
– bfavaretto
Your doubt is already another, I think it would be interesting to close this question and make a new one with your doubts!
– Rafael Balmant