文档Here建议php artisan passport:client --client
用于创建客户端,但是我想使用控制器来实现,或者理想情况下,要使用通行证提供的本机JSON API。
可能吗?还是我必须重写Passport::client
中的方法?
答案 0 :(得分:0)
你可以
const App = () => {
const [itemsAmount] = useState(1000);
const [keys, setKeys] = useState([]);
const [products, setProducts] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
const [productsPerPage, setProductsPerPage] = useState(10);
/* Get current products*/
const indexOfLastProduct = currentPage * productsPerPage;
const indexOfFirstProduct = indexOfLastProduct - productsPerPage;
const currentProducts = products.slice(indexOfFirstProduct, indexOfLastProduct);
/* Change page */
const pagesCount = Math.ceil(products.length / productsPerPage)
<div className="">
<ReactPaginate
previousLabel = {'Previous'}
nextLabel = {'Next'}
breakLabel = {' ... '}
pageCount = {pagesCount}
onPageChange={ (data) => { setCurrentPage(data.selected+1)} }
containerClassName={'pagination'}
subContainerClassName={'pages pagination'}
activeClassName={'active'}
/>
<Products products={currentProducts} keys={keys} />
</div>
}