Skip to content

Commit

Permalink
added product listing page
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalverson committed Sep 4, 2024
1 parent 73ac61e commit 7ed59e5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Routes, Route, Outlet, Link } from "react-router-dom";
import ProductPage from './pages/Product';
import ProductList from './pages/ProductList';

function App() {

Expand All @@ -8,6 +9,7 @@ function App() {
<Routes>
<Route path="/" element={<Layout />} />
<Route index element={<ProductPage />} />
<Route path='list' element={<ProductList />} />

</Routes>

Expand Down
22 changes: 22 additions & 0 deletions src/pages/ProductList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { useEffect } from 'react'

Check failure on line 1 in src/pages/ProductList.tsx

View workflow job for this annotation

GitHub Actions / build

'React' is declared but its value is never read.

Check failure on line 1 in src/pages/ProductList.tsx

View workflow job for this annotation

GitHub Actions / deploy

'React' is declared but its value is never read.

const BASE_URL = 'https://3dprinter-web-api.benhalverson.workers.dev/list'

const getData = async () => {
const response = await fetch(BASE_URL)
const data = await response.json()
console.log('data', data)
return data
}


function ProductList() {
useEffect(() => {
getData()
}, [])
return (
<div>ProductList</div>
)
}

export default ProductList

0 comments on commit 7ed59e5

Please sign in to comment.