File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 22import { useEffect , useState } from "react" ;
33import { productType } from "@/types/productType" ;
44import { ProductList } from "./components/productList" ;
5- import { api } from "./services/api" ;
65export 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 ) ;
You can’t perform that action at this time.
0 commit comments