Skip to content

Commit 0f847bc

Browse files
committed
Update application to work with latest versions of plugins
1 parent 5187587 commit 0f847bc

File tree

11 files changed

+32
-36
lines changed

11 files changed

+32
-36
lines changed

components/Cart/AddToCartButton.component.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { useQuery, useMutation } from '@apollo/client';
77
import { AppContext } from 'utils/context/AppContext';
88
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';
99

10-
import { GET_CART } from 'utils/const/GQL_QUERIES';
11-
import { ADD_TO_CART } from 'utils/const/GQL_MUTATIONS';
10+
import { GET_CART } from 'utils/gql/GQL_QUERIES';
11+
import { ADD_TO_CART } from 'utils/gql/GQL_MUTATIONS';
1212

1313
import { getFormattedCart } from 'utils/functions/functions';
1414

@@ -23,7 +23,7 @@ const AddToCartButton = ({ product }) => {
2323
const [showViewCart, setShowViewCart] = useState(false);
2424
const [showAddToCart, setshowAddToCart] = useState(false);
2525

26-
const productId = product.productId ? product.productId : product;
26+
const productId = product.databaseId ? product.databaseId : product;
2727

2828
const productQueryInput = {
2929
clientMutationId: uuidv4(), // Generate a unique id.

components/Cart/CartPage/CartItemsContainer.component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import RegularCart from './RegularCart.component';
1414
import MobileCart from './MobileCart.component';
1515
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';
1616

17-
import { GET_CART } from 'utils/const/GQL_QUERIES';
18-
import { UPDATE_CART } from 'utils/const/GQL_MUTATIONS';
17+
import { GET_CART } from 'utils/gql/GQL_QUERIES';
18+
import { UPDATE_CART } from 'utils/gql/GQL_MUTATIONS';
1919

2020
const CartItemsContainer = () => {
2121
const [cart, setCart] = useContext(AppContext);

components/Checkout/CheckoutForm.component.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import MobileOrderDetails from './MobileOrderDetails.component';
77
import LoadingSpinner from '../LoadingSpinner/LoadingSpinner.component';
88
//import Payment from './Payment.component';
99

10-
import { GET_CART } from 'utils/const/GQL_QUERIES';
11-
import { CHECKOUT_MUTATION } from 'utils/const/GQL_MUTATIONS';
10+
import { GET_CART } from 'utils/gql/GQL_QUERIES';
11+
import { CHECKOUT_MUTATION } from 'utils/gql/GQL_MUTATIONS';
1212

1313
import { AppContext } from 'utils/context/AppContext';
1414

components/Product/IndexProducts.component.jsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Link from 'next/link';
22
import { v4 as uuidv4 } from 'uuid';
33

4-
import WOO_CONFIG from 'utils/config/nextConfig';
4+
import WOO_CONFIG from 'utils/config/nextConfig';
55

66
/**
77
* Displays all of the products as long as length is defined.
@@ -16,7 +16,8 @@ const IndexProducts = ({ products }) => {
1616
{products ? (
1717
products.map(
1818
({
19-
productId,
19+
id,
20+
databaseId,
2021
name,
2122
price,
2223
regularPrice,
@@ -29,10 +30,7 @@ const IndexProducts = ({ products }) => {
2930
key={uuidv4()}
3031
className="flex flex-col p-6 md:w-1/2 xl:w-1/4"
3132
>
32-
<Link
33-
href="/produkt/[post]"
34-
as={`/produkt/${slug}?productId=${productId}`}
35-
>
33+
<Link href="/produkt/[post]" as={`/produkt/${slug}?id=${id}`}>
3634
<a>
3735
{image ? (
3836
<img
@@ -51,10 +49,7 @@ const IndexProducts = ({ products }) => {
5149
)}
5250
</a>
5351
</Link>
54-
<Link
55-
href="/produkt/[post]"
56-
as={`/produkt/${slug}?productId=${productId}`}
57-
>
52+
<Link href="/produkt/[post]" as={`/produkt/${slug}?id=${id}`}>
5853
<a>
5954
<div className="flex justify-center pt-3">
6055
<p className="font-bold text-center cursor-pointer">

pages/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import PageTitle from 'components/Title/PageTitle.component';
55

66
import client from 'utils/apollo/ApolloClient.js';
77

8-
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/const/GQL_QUERIES';
8+
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/gql/GQL_QUERIES';
99

1010
/**
1111
* Main index page
1212
* @param {Object} products
13-
* Initial static data is sent as props from getStaticProps and loaded through 'utils/const/INITIAL_PRODUCTS'
13+
* Initial static data is sent as props from getStaticProps and loaded through 'utils/gql/INITIAL_PRODUCTS'
1414
*/
1515
const HomePage = ({ products }) => {
1616
return (

pages/kategori/[slug].js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import PageTitle from 'components/Title/PageTitle.component';
66

77
import client from 'utils/apollo/ApolloClient';
88

9-
import { GET_PRODUCTS_FROM_CATEGORY } from 'utils/const/GQL_QUERIES';
9+
import { GET_PRODUCTS_FROM_CATEGORY } from 'utils/gql/GQL_QUERIES';
1010

1111
/**
1212
* Display a single product with dynamic pretty urls

pages/kategorier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PageTitle from 'components/Title/PageTitle.component';
55

66
import client from 'utils/apollo/ApolloClient.js';
77

8-
import { FETCH_ALL_CATEGORIES_QUERY } from 'utils/const/GQL_QUERIES';
8+
import { FETCH_ALL_CATEGORIES_QUERY } from 'utils/gql/GQL_QUERIES';
99

1010
/**
1111
* Category page displays all of the categories

pages/produkt/[slug].js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Header from 'components/Header/Header.component';
55

66
import client from 'utils/apollo/ApolloClient';
77

8-
import { GET_SINGLE_PRODUCT } from 'utils/const/GQL_QUERIES';
8+
import { GET_SINGLE_PRODUCT } from 'utils/gql/GQL_QUERIES';
99

1010
/**
1111
* Display a single product with dynamic pretty urls
@@ -33,10 +33,10 @@ const Produkt = ({ product }) => {
3333

3434
export default withRouter(Produkt);
3535

36-
export async function getServerSideProps({ query: { productId } }) {
36+
export async function getServerSideProps({ query: { id } }) {
3737
const res = await client.query({
3838
query: GET_SINGLE_PRODUCT,
39-
variables: { id: productId },
39+
variables: { id: id },
4040
});
4141

4242
return {

pages/produkter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import IndexProducts from 'components/Product/IndexProducts.component';
33
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component';
44
import PageTitle from 'components/Title/PageTitle.component';
55

6-
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/const/GQL_QUERIES';
6+
import { FETCH_ALL_PRODUCTS_QUERY } from 'utils/gql/GQL_QUERIES';
77

88
import client from 'utils/apollo/ApolloClient.js';
99

utils/const/GQL_MUTATIONS.js renamed to utils/gql/GQL_MUTATIONS.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const ADD_TO_CART = gql`
77
key
88
product {
99
id
10-
productId
10+
databaseId
1111
name
1212
description
1313
type
@@ -30,7 +30,7 @@ export const ADD_TO_CART = gql`
3030
}
3131
variation {
3232
id
33-
variationId
33+
databaseId
3434
name
3535
description
3636
type
@@ -67,7 +67,7 @@ export const CHECKOUT_MUTATION = gql`
6767
clientMutationId
6868
order {
6969
id
70-
orderId
70+
databaseId
7171
refunds {
7272
nodes {
7373
amount

0 commit comments

Comments
 (0)