POST request in nextjs 14
Unanswered
Oriental Scops-Owl posted this in #help-forum
Oriental Scops-OwlOP
can someone link me to a guide to send a post request to my API inside of nextjs 14 from an action file? google is sending me in circles
6 Replies
Oriental Scops-OwlOP
spoke too soon sorry:
does this seem right?
fetch('/api/route-name', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(objectWithData),
})does this seem right?
Oriental Scops-OwlOP
i have this:
and this as my action:
im receiving undefined inside of my console.log
oh.. one sec
k i figured it out sorry