Skip to content

Commit

Permalink
Merge pull request #76 from fs-jun24-team-3/fix/button
Browse files Browse the repository at this point in the history
add button fix
  • Loading branch information
k-marchuk authored Sep 25, 2024
2 parents c3888ee + 3af60eb commit 6ce1604
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/pages/CartPage/CartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import {
selectTotalCost,
selectTotalQuentity,
} from '../../app/slices/cartSlise';
import { addToOrder } from '../../app/slices/orderSlice';
// import { addToOrder } from '../../app/slices/orderSlice';
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
type Props = {};

export const CartPage: React.FC<Props> = () => {
const navigate = useNavigate();
const dispatch = useAppDispatch();
const cartItems = useAppSelector((state: RootState) => state.cart.cartItems);
// const isCartEmpty = cartItems.length < 1;
const isCartEmpty = cartItems.length < 1;
const totalCost = useAppSelector((state: RootState) =>
selectTotalCost(state.cart),
);
Expand All @@ -32,12 +32,10 @@ export const CartPage: React.FC<Props> = () => {

const saveOrder = () => {
if (cartItems.length !== 0) {
dispatch(addToOrder(cartItems));
dispatch(clearCart());
navigate('/user');
}
};

return (
<div className="cart">
<BackButton />
Expand All @@ -62,6 +60,8 @@ export const CartPage: React.FC<Props> = () => {
styleList={{
height: 48,
}}
useSucceessAnimation={true}
isError={isCartEmpty}
onClick={saveOrder}
/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/UserPage/UserPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const UserPage: React.FC = () => {
const onSubmit = (data: FormData) => {
console.log(data);
localStorage.setItem('userData', JSON.stringify(data));
alert('Data saved successfully!');
// alert('Data saved successfully!');
reset();
};

Expand Down

0 comments on commit 6ce1604

Please sign in to comment.