Skip to content

Commit 904f401

Browse files
committed
Remove unused code
1 parent 0295eed commit 904f401

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

components/Cart/CartPage/CartItemsContainer.component.jsx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { useContext, useState } from 'react';
44
import { useQuery, useMutation } from '@apollo/client';
55

66
import { AppContext } from 'utils/context/AppContext';
7-
import {
8-
getFormattedCart,
9-
getUpdatedItems,
10-
} from 'utils/functions/functions';
7+
import { getFormattedCart, getUpdatedItems } from 'utils/functions/functions';
118

129
import RegularCart from './RegularCart.component';
1310
import MobileCart from './MobileCart.component';
@@ -21,23 +18,19 @@ const CartItemsContainer = () => {
2118
const [requestError, setRequestError] = useState(null);
2219

2320
// Update Cart Mutation.
24-
const [
25-
updateCart,
21+
const [updateCart, { loading: updateCartProcessing }] = useMutation(
22+
UPDATE_CART,
2623
{
27-
data: updateCartResponse,
28-
loading: updateCartProcessing,
29-
error: updateCartError,
30-
},
31-
] = useMutation(UPDATE_CART, {
32-
onCompleted: () => {
33-
refetch();
34-
},
35-
onError: (error) => {
36-
if (error) {
37-
setRequestError(error);
38-
}
39-
},
40-
});
24+
onCompleted: () => {
25+
refetch();
26+
},
27+
onError: (error) => {
28+
if (error) {
29+
setRequestError(error);
30+
}
31+
},
32+
}
33+
);
4134

4235
/*
4336
* Handle remove product click.
@@ -65,7 +58,7 @@ const CartItemsContainer = () => {
6558
}
6659
};
6760

68-
const { loading, error, data, refetch } = useQuery(GET_CART, {
61+
const { data, refetch } = useQuery(GET_CART, {
6962
notifyOnNetworkStatusChange: true,
7063
onCompleted: () => {
7164
// Update cart in the localStorage.
@@ -82,6 +75,7 @@ const CartItemsContainer = () => {
8275
<>
8376
<section className="py-8 bg-white">
8477
<div className="container flex flex-wrap items-center mx-auto">
78+
{requestError && <div className="p-6 mx-auto mt-5">Error ... </div>}
8579
{cart ? (
8680
<div className="p-6 mx-auto mt-5">
8781
<RegularCart

0 commit comments

Comments
 (0)