Browse Source

領収書一覧 データない場合にテーブルを表示しないように修正

develop
sosuke.iwabuchi 2 years ago
parent
commit
4622b91d72
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      src/pages/dashboard/receipt/download.tsx

+ 14
- 2
src/pages/dashboard/receipt/download.tsx View File

@@ -15,7 +15,7 @@ import useAPICall from "hooks/useAPICall";
import useDashboard from "hooks/useDashBoard"; import useDashboard from "hooks/useDashBoard";
import useTable from "hooks/useTable"; import useTable from "hooks/useTable";
import { PageID, TabID } from "pages"; import { PageID, TabID } from "pages";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import { numberFormat } from "utils/string"; import { numberFormat } from "utils/string";


const TABLE_HEAD: HeadLabelProps[] = [ const TABLE_HEAD: HeadLabelProps[] = [
@@ -31,6 +31,8 @@ export default function ReceiptDownload() {
TabID.NONE TabID.NONE
); );


const [fetched, setFetched] = useState(false);

const { const {
order, order,
page, page,
@@ -57,7 +59,9 @@ export default function ReceiptDownload() {
}); });


useEffect(() => { useEffect(() => {
callGetReceipts({});
callGetReceipts({}).then(() => {
setFetched(true);
});
}, []); }, []);


useEffect(() => { useEffect(() => {
@@ -65,6 +69,14 @@ export default function ReceiptDownload() {
setTabs(null); setTabs(null);
}, [setHeaderTitle, setTabs]); }, [setHeaderTitle, setTabs]);


if (!fetched) {
return null;
}

if (dataLength === 0) {
return <Box>データがありません</Box>;
}

return ( return (
<Box> <Box>
<TableContainer <TableContainer


Loading…
Cancel
Save