import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' import { formatIDR } from '@/utils' 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 (
{user.fullname}
Saldo
Rp {user.display_deposit}
router.get(route('customer.deposit.topup')) } > Top Up
{deposites.map((history) => (
router.get( route( 'customer.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
)}
) }