WDI-SEA / project-4-issues

Open an issue to receive help on project 4 issues
0 stars 0 forks source link

Passing Data from React to Django #23

Closed hectorzaragoza closed 2 years ago

hectorzaragoza commented 2 years ago

What stack are you using?

Django - React

What's the problem you're trying to solve?

I am trying to pass a state from React to Django API to create a conditional statement in the backend based on what the user selects on the front end.

Post any code you think might be relevant (one fenced block per file)

Front End Code image

Back End Code image

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

My QueryDict is empty.

What is your best guess as to the source of the problem?

I am not passing form data correctly.

What things have you already tried to solve the problem?

Tried different parsers from Django and different form inputs.

timmshinbone commented 2 years ago

Were those supposed to be screenshots? I can't see the images.

hectorzaragoza commented 2 years ago

Were those supposed to be screenshots? I can't see the images.

I just edited it - they should be viewable now.

hectorzaragoza commented 2 years ago

We solved this issue by creating an axios call to carry a payload from FE to BE. However, adding the onSubmit functionality to do the axios call and removing the form action that triggered the STRIPE API checkout session, resulted in the data being transferred but a failed connection to Stripe. So, I ended up including both an onSubmit for Axios and an Action for the routing to Stripe.