import { Box, Button } from "@mui/material"
import { Link } from "react-router-dom"
import { useGetGoodFindQuery } from "../../../store/categoriesApi"
import AdminGoodsTable from "../AdminGoodsTable"





const AdminGoods = () => {
  const getGoodFind = useGetGoodFindQuery(
    {
    categoryId: null,
    sort: {price: 1},
    skip: 0, 
    limit: 100
})

console.log(getGoodFind)

//   const sortQeryArr = [
//     {
//         categoryId: null,
//         sort: {price: 1},
//         skip: (page - 1) * limit, 
//         limit
//     },
//     {
//         categoryId: null,
//         sort: {price: -1},
//         skip: (page - 1) * limit,
//         limit
//     },
//     {
//         categoryId: null,
//         sort: {name: 1},
//         skip: (page - 1) * limit,
//         limit
//     },
//     {
//         categoryId: null,
//         sort: {createdAt: -1},
//         skip: (page - 1) * limit,
//         limit
//     },
// ]


  return (
    <Box width={'100%'} >
    <Link to='/admin/addNewGood'><Button>Добавить товар</Button></Link>
    
      <Box width={'100%'} mb={2} p={1} sx={{ display: 'flex', justifyContent: "space-between" }}>
        <AdminGoodsTable/>
      </Box>
    </Box>
  )
}

export default AdminGoods