import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' import { HiOutlineQuestionMarkCircle } from 'react-icons/hi2' import HeaderTrx from '../Components/HeaderTrx' export default function Index({ auth: { user }, histories: { data, next_page_url }, }) { const [deposites, setDeposites] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['histories'], onSuccess: (res) => { setDeposites(deposites.concat(res.props.histories.data)) }, } ) } return (
{deposites.map((history) => (
router.get( route( 'transactions.deposit.show', history.id ) ) } >
{history.format_human_created_at}
{history.description}
{history.amount}
{+history.is_valid !== 0 && (
{history.status.text}
)}
))} {next_page_url !== null && (
Load more
)}
) }