-1

I have a problem with client and server side in Next.js v13. There is an api. I brought the data from this API by making a request to the server side section. I sent the data (prop) in the server side to the client side. then I used this data in client side. How can I send the data I use back to the server side? I want to get new data by sending the data I processed in the client side to the API again.

Note: I can't do API, fetch requests on client side. That's why there is a server side in between. I want to send my parameters to server side and get updated data again. Please help with this.

Look example picture:

I take data from API:

enter image description here

I send it to the server side and run the function to pull the data: and then send it to the client side as a prop:

enter image description here

I took the data from the client side as a prop. I used and modified this data. I want to create a parameter again and send a request to the API. I couldn't find how to request the a API and get the updated new data...:

enter image description here

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

How can I send the data I use back to the server side? I want to get new data by sending the data I processed in the client side to the API again.

  1. Create an API that accepts POST requests
  2. Call that API from the client component and pass the intended information in the body
  3. You can then extract the necessary parameters from the body and execute the necessary logic on the server side.

Does that help ? If not, please provide more details.

Thank you

Filippo
  • 11
  • 4