Skip to content

Commit 63a3b2d

Browse files
authored
Merge pull request #300 from w3bdesign/develop
Remove unused code and cleanup
2 parents 49a8ba9 + 904f401 commit 63a3b2d

File tree

6 files changed

+17
-56
lines changed

6 files changed

+17
-56
lines changed

.vscode/css_custom_data.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-woocommerce",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Nextjs WooCommerce webshop",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)