(props)
| 5 | import CheckoutSteps from '../components/CheckoutSteps'; |
| 6 | |
| 7 | function PaymentScreen(props) { |
| 8 | const [paymentMethod, setPaymentMethod] = useState(''); |
| 9 | |
| 10 | const dispatch = useDispatch(); |
| 11 | |
| 12 | const submitHandler = (e) => { |
| 13 | e.preventDefault(); |
| 14 | dispatch(savePayment({ paymentMethod })); |
| 15 | props.history.push('placeorder'); |
| 16 | }; |
| 17 | return ( |
| 18 | <div> |
| 19 | <CheckoutSteps step1 step2 step3></CheckoutSteps> |
| 20 | <div className="form"> |
| 21 | <form onSubmit={submitHandler}> |
| 22 | <ul className="form-container"> |
| 23 | <li> |
| 24 | <h2>Payment</h2> |
| 25 | </li> |
| 26 | |
| 27 | <li> |
| 28 | <div> |
| 29 | <input |
| 30 | type="radio" |
| 31 | name="paymentMethod" |
| 32 | id="paymentMethod" |
| 33 | value="paypal" |
| 34 | onChange={(e) => setPaymentMethod(e.target.value)} |
| 35 | ></input> |
| 36 | <label for="paymentMethod">Paypal</label> |
| 37 | </div> |
| 38 | </li> |
| 39 | |
| 40 | <li> |
| 41 | <button type="submit" className="button primary"> |
| 42 | Continue |
| 43 | </button> |
| 44 | </li> |
| 45 | </ul> |
| 46 | </form> |
| 47 | </div> |
| 48 | </div> |
| 49 | ); |
| 50 | } |
| 51 | export default PaymentScreen; |
nothing calls this directly
no outgoing calls
no test coverage detected