Commit 87f18bac authored by Christopher Cottier's avatar Christopher Cottier

redirect to order confirmation upon order submission

parent 1240e5af
...@@ -8,6 +8,7 @@ import SubmitOrder from './SubmitOrder.js' ...@@ -8,6 +8,7 @@ import SubmitOrder from './SubmitOrder.js'
import './checkout.css' import './checkout.css'
import {dispatchOrderInfo} from './../../actions/checkout_actions' import {dispatchOrderInfo} from './../../actions/checkout_actions'
import { Redirect } from 'react-router'
export default function Checkout() { export default function Checkout() {
...@@ -156,6 +157,10 @@ export default function Checkout() { ...@@ -156,6 +157,10 @@ export default function Checkout() {
} }
//redirect to order confirmation page once reponse is recieved
const {orderResponse} = useSelector(state => state.orderStatus);
if (orderResponse.id) return <Redirect to="/order-confirmation" />
return ( return (
<div id="checkout-container"> <div id="checkout-container">
......
...@@ -3,7 +3,6 @@ import { LOGOUT_USER } from '../actions/session_actions'; ...@@ -3,7 +3,6 @@ import { LOGOUT_USER } from '../actions/session_actions';
import {SEND_USER_ORDER} from './../actions/checkout_actions' import {SEND_USER_ORDER} from './../actions/checkout_actions'
const initialState = { const initialState = {
//this will be empty object once we have checkout flow, rn just for conf page building / logic
orderResponse: {}, orderResponse: {},
orderHistory: [] orderHistory: []
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment