Skip to content

Commit

Permalink
more safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakob-SA committed Nov 28, 2024
1 parent 0c5b210 commit 46be3a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 13 additions & 0 deletions Frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Frontend/src/views/singleWare/singleWare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function SingleWare() {
<p className="text-gray-500">Price: </p>
</div>
<p className="text-gray-500">
Ends at {item.auctionEnd ? item.auctionEnd.toLocaleString() : "N/A"}
Ends at{" "}
{item.auctionEnd ? item.auctionEnd.toLocaleString() : "N/A"}
</p>
</div>

Expand All @@ -114,12 +115,14 @@ function SingleWare() {
</div>
<h2 className="text-lg font-bold mb-2">Previous Bids</h2>
<div className="rounded-lg p-4 max-h-40 overflow-y-auto">
{bids.length > 0 ? (
{Array.isArray(bids) && bids.length > 0 ? (
<ul>
{bids.map((bid, index) => (
<li key={index} className="mb-1">
<strong>
{bid.bidTime ? new Date(bid.bidTime).toLocaleString() : "N/A"}
{bid.bidTime
? new Date(bid.bidTime).toLocaleString()
: "N/A"}
</strong>
: {bid.bidAmount}
</li>
Expand Down

0 comments on commit 46be3a6

Please sign in to comment.