import React, { useState, useEffect, useRef } from 'react'; import { Redirect } from 'react-router-dom'; import AllCard from '../Components/AllCard'; import Pagination from '../Components/Pagination'; import axios from 'axios'; import catchError from '../utils/catchErrors'; import { Row, Form, FormControl, Button, Container } from 'react-bootstrap'; function Admin() { const [productlist, setProductlist] = useState([]) const [error, setError] = useState('') useEffect(() => { getProductlist() }, []) async function getProductlist() { try { const response = await axios.get(`/api/product/getproduct/all`) console.log("response.data=", response.data) setProductlist(response.data) } catch (error) { catchError(error, setError) } } function handleSearch() { } function handleSubmit(e) { e.preventDefault() } return ( {productlist.map(pro => ( ))} ) } export default Admin