GithubHelp home page GithubHelp logo

Comments (14)

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024 1

Try it multiple times don't give up it will work

code didn't help then you should check
savePaymentMethod did work properly

from amazona.

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024

check sumbithandler.

from amazona.

 avatar commented on May 13, 2024

from amazona.

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024

where did you have put that

on form or button
if you have put it in
form then use onSubmit event
for button use onClick event

from amazona.

 avatar commented on May 13, 2024

mohitshahu,

I appreciate your reply. I believe on form but I am not sure. Please take a look at my code if you can and thank you very much for your help.

import React, { useState } from 'react'
import { useDispatch, useSelector } from 'react-redux';
import { savePaymentMethod } from '../actions/cartActions';
import CheckoutSteps from '../components/CheckoutSteps';

export default function PaymentMethodScreen(props) {
const cart = useSelector((state) => state.cart);
const { shippingAddress } = cart;
if (!shippingAddress.address) {
props.history.push('/shipping');
}
const [paymentMethod, setPaymentMethod] = useState('PayPal');
const dispatch = useDispatch();
const submitHandler = (e) => {
e.preventDefault();
dispatch(savePaymentMethod(paymentMethod));
props.history.push('/placeorder');
};

from amazona.

 avatar commented on May 13, 2024

Do I need to have history as a prop?

from amazona.

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024

sorry for the late response buddy

Do I need to have history as a prop?
:: no not at history is property of props object.
we can assess it like props.history.

from amazona.

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024

After going through your code I didn't find any issue.
After all, I am also a beginner πŸ˜‚.

Here is my code, if it can help
import React, { useState } from "react";
import CheckoutSteps from "../CheckoutSteps/CheckoutSteps";
import { useDispatch, useSelector } from "react-redux";
import { savePaymentMethod } from "../../../redux/actions/cartActions";

export default function PaymentMethodScreen(props) {
const cart = useSelector((state) => state.cart);
const { shippingAddress } = cart;
if(!shippingAddress.address){
props.history.push('/shipping');
}
const [paymentMethod, setPaymentMethod] = useState("PayPal");
const dispatch = useDispatch();
const submintHandler = (e) => {
e.preventDefault();
dispatch(savePaymentMethod(paymentMethod));
props.history.push("/placeorder");
};
return (





Payment





<input
type="radio"
id="paypal"
value="PayPal"
name="paymentMethod"
required
checked
onChange={(e) => setPaymentMethod(e.target.value)}
/>
Paypal


<input
type="radio"
id="stripe"
value="Stripe"
name="paymentMethod"
required
onChange={(e) => setPaymentMethod(e.target.value)}
/>
Stripe



Continue



);
}

from amazona.

mohitshahu108 avatar mohitshahu108 commented on May 13, 2024

i have completed that application

deployed over heruko
https://tech360i.herokuapp.com/

from amazona.

GarvitSharma870 avatar GarvitSharma870 commented on May 13, 2024

Hllo mohitsahu I will also got error after deploying on heroku my products not showing after deploy on heroku in local host it will saw but when I connect with online MongoDB atlas it will not show please help me

from amazona.

GarvitSharma870 avatar GarvitSharma870 commented on May 13, 2024

i have completed that application

deployed over heruko
https://tech360i.herokuapp.com/

Hllo please help me when I deploy it to heroku and when I will connect with MongoDB atlas it will not insert my sample users and product into online MongoDB atlas database so i will copy paste products data manually it will show product but when I click on product It will show error product not found can you help me to solve this.
And when I register as newbuddy it insert data in online database and also signin works with that .

from amazona.

 avatar commented on May 13, 2024

from amazona.

GarvitSharma870 avatar GarvitSharma870 commented on May 13, 2024

mohitshahu108, I apologize for the very late response. I also have since completed the project and I really appreciate your help. Great job with the website! Thank you
…
Sent from my iPhone
On May 23, 2021, at 3:13 AM, mohitshahu108 @.***> wrote: i have completed that application deployed over heruko https://tech360i.herokuapp.com/ β€” You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Hey DmoniqueMCasteneda ,please help me when I deploy it to heroku and when I will connect with MongoDB atlas it will not insert my sample users and product into online MongoDB atlas database so i will copy paste products data manually it will show product but when I click on product It will show error product not found can you help me to solve this.
And when I register as newbuddy it insert data in online database and also signin works with that .

from amazona.

 avatar commented on May 13, 2024

from amazona.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.