import React, { useState } from 'react' import { Head, router } from '@inertiajs/react' import CustomerLayout from '@/Layouts/CustomerLayout' const EmptyHere = () => { return (
Transaksi kosong
Yuk, checkout kerangjang mu sekarang!
) } export default function Index({ query: { data, next_page_url } }) { const [sales, setSales] = useState(data) const handleNextPage = () => { router.get( next_page_url, {}, { replace: true, preserveState: true, only: ['query'], onSuccess: (res) => { setSales(sales.concat(res.props.query.data)) }, } ) } return (
Transaksi Pembelian
{sales.length <= 0 && }
{sales.map((sale) => (
router.get( route('transactions.show', sale.id) ) } >
{sale.format_human_created_at}
Invoice{' '} #{sale.code}
{sale.display_amount}
))} {next_page_url !== null && (
Load more
)}
) }