meabhisingh / mernProjectEcommerce

This is MERN Stack Ecommerce Project Made to Teach MERN Stack on YouTube
1.15k stars 828 forks source link

Redirection function error in Cart.jsx #98

Open swapnilgithubexe opened 3 weeks ago

swapnilgithubexe commented 3 weeks ago

Hi,

Route - Frontend/src/components/Cart/Cart.js

code: const checkoutHandler = () => { history.push("/login?redirect=shipping"); };

need to change the path to absolute path.

example: import {useNavigate} from "react-router-dom"; navigate = useNavigate(); navigate("/login?redirect=shipping");

in the above routing function the code will not give the expected output as after the execution of isAuth check, it will redirect to /login/shipping and we don't that, so instead modify the code as follows.

import {useNavigate} from "react-router-dom"; navigate = useNavigate(); navigate("/login?redirect=/shipping");

change - added a forward slash

Hope it helps Swapnil