I need to make an enrollment for Course Instructors, in which each instructor will have a course. How do I?
I'm doing it that way and it's not going:
PS.: variable name and email receive a variable in String
, already the course variable receives the course object.
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 registerInstructor, it gives me the error:
TypeError: Can not read property '1' of undefined
Specifically when attempting to save the course variable