Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/thith'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thith-thith committed Aug 7, 2023
2 parents 0cf4832 + 71df3ff commit 0b92931
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions client/src/pages/products/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Component, For, Show, createResource } from "solid-js";
import Cards from "../../components/cards/Cards";
const fetchData = async () => {
const res = await fetch("https://cptdb.koompi.com/CoreProducts");
return res.json();
};

const Products: Component<{}> = () => {
const [AllCoreProducts] = createResource(fetchData);
const fetchData = async () => {
const res = await fetch("https://cptdb.koompi.com/CoreProducts");
return res.json();
};

const [allProducts] = createResource(fetchData);

return (
<div class="mx-auto sm:max-w-xl md:max-w-full lg:max-w-screen-xl">
Expand Down Expand Up @@ -686,8 +687,8 @@ const Products: Component<{}> = () => {

<div class="lg:col-span-3">
<div class="grid md:grid-cols-3 gap-4 mt-4">
<Show when={AllCoreProducts()} fallback={<p>Loading...</p>}>
<For each={AllCoreProducts()}>
<Show when={allProducts()} fallback={<p>Loading...</p>}>
<For each={allProducts()}>
{(CoreProducts) => {
return <Cards product={CoreProducts} />;
}}
Expand Down

0 comments on commit 0b92931

Please sign in to comment.