From 8259d749775a399d11a76d931144584cc6ad325e Mon Sep 17 00:00:00 2001 From: Gabriel Castro Date: Tue, 25 Feb 2025 16:18:03 -0300 Subject: [PATCH] feat: pick ledger id by ledger selector instead path params --- src/app/(routes)/assets/page.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/app/(routes)/assets/page.tsx b/src/app/(routes)/assets/page.tsx index 99a713b1..5a863a5f 100644 --- a/src/app/(routes)/assets/page.tsx +++ b/src/app/(routes)/assets/page.tsx @@ -27,23 +27,20 @@ const Page = () => { const intl = useIntl() const { id: ledgerId } = useParams<{ id: string }>() const [columnFilters, setColumnFilters] = useState([]) - const { currentOrganization, currentLedgerId } = useOrganization() + const { currentOrganization, currentLedger } = useOrganization() const { showSuccess, showError } = useCustomToast() const { handleCreate, handleEdit, sheetProps } = useCreateUpdateSheet() const [total, setTotal] = useState(0) const { form, searchValues, pagination } = useQueryParams({ total }) - console.log('currentOrg-> ', currentOrganization) - console.log('currentLedger-> ', currentLedgerId) - const { data: assets, refetch, isLoading } = useListAssets({ organizationId: currentOrganization.id!, - ledgerId: currentLedgerId, + ledgerId: currentLedger.id, ...(searchValues as any) }) @@ -53,7 +50,7 @@ const Page = () => { const { mutate: deleteMutate, isPending: deletePending } = useDeleteAsset({ organizationId: currentOrganization.id!, - ledgerId, + ledgerId: currentLedger.id, onSuccess: () => { handleDialogClose() refetch() @@ -103,10 +100,7 @@ const Page = () => { name: currentOrganization.legalName }, { - name: intl.formatMessage({ - id: `ledgers.title`, - defaultMessage: 'Ledgers' - }) + name: currentLedger.name }, { name: intl.formatMessage({