Skip to content

Commit feaf78b

Browse files
Update page.tsx
1 parent 48977a6 commit feaf78b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/app/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
import { useEffect, useState } from "react";
33
import { productType } from "@/types/productType";
44
import { ProductList } from "./components/productList";
5-
import { api } from "./services/api";
65
export default function Home() {
76
const [data, setData] = useState<productType[]>([]); // Estado para armazenar os produtos
87

98
const fetchProducts = async () => {
109
try {
1110
const timestamp = new Date().getTime(); // Você pode usar esse timestamp para evitar cache em URL se quiser
12-
const res = await api.get<productType[]>(`/product`);
13-
console.log(res.data);
14-
const json = res.data;
11+
const res = await fetch("https://ecommerce-cart-0v1d.onrender.com/product", {
12+
cache: "no-store",
13+
});
14+
const json = await res.json();
1515
setData(json); // Atualiza o estado com os dados
1616
} catch (error) {
1717
console.error("Erro ao buscar produtos:", error);

0 commit comments

Comments
 (0)