Skip to content

Commit

Permalink
Upgrade Next.js
Browse files Browse the repository at this point in the history
  • Loading branch information
w3bdesign committed May 11, 2020
1 parent 9bab6c6 commit 72e83bb
Show file tree
Hide file tree
Showing 8 changed files with 1,289 additions and 698 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# dependencies
/node_modules
node_modules
.next

# testing
Expand Down
2 changes: 1 addition & 1 deletion components/Header.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Head from 'next/head';
function Header() {
return (
<Head>
<title>Nextjs ecommerce with Woocommerce</title>
<title>Nextjs Ecommerce with Woocommerce</title>
<meta
property="og:title"
content="Nextjs ecommerce with Woocommerce"
Expand Down
5 changes: 5 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"baseUrl": "."
}
}
1,955 changes: 1,265 additions & 690 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-woocommerce",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -13,7 +13,7 @@
"license": "ISC",
"dependencies": {
"@woocommerce/woocommerce-rest-api": "^1.0.1",
"next": "^9.3.6",
"next": "^9.4.0",
"node-fetch": "^2.6.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
Expand Down
11 changes: 11 additions & 0 deletions pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Will be called once for every metric that has to be reported.
export function reportWebVitals(metric) {
// These metrics can be sent to any analytics service
// console.log(metric);
}

function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}

export default MyApp;
6 changes: 3 additions & 3 deletions pages/api/getWooProducts.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const WooCommerce = new WooCommerceRestApi({
version: 'wc/v3',
});

async function getProductsFromRest() {
return await WooCommerce.get('products');
function getProductsFromRest() {
return WooCommerce.get('products');
}

export async function getWooProducts(req, res) {
const WooProducts = getProductsFromRest();
const WooProducts = await getProductsFromRest();
res.status(200).json(WooProducts.data);
}

Expand Down
3 changes: 1 addition & 2 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fetch from 'node-fetch';
import Header from "components/Header.component"

import Header from '../components/Header.component';

function HomePage(props) {
// We can destructure here or inside the map.
Expand Down

0 comments on commit 72e83bb

Please sign in to comment.