-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/AlexGottschalkSE/APDS7311POE
- Loading branch information
Showing
10 changed files
with
170 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.card { | ||
background: white; | ||
border-radius: 8px; | ||
padding: 20px; | ||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
max-width: 400px; | ||
margin: auto; | ||
} | ||
|
||
.card h2 { | ||
margin-bottom: 20px; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
border: 1px solid #ddd; | ||
border-radius: 4px; | ||
} | ||
|
||
button { | ||
width: 100%; | ||
padding: 10px; | ||
background-color: #007bff; | ||
color: white; | ||
border: none; | ||
border-radius: 4px; | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
background-color: #0056b3; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import "./History.css"; | ||
|
||
const History = () => { | ||
const [transactions, setTransactions] = useState([]); | ||
const [loading, setLoading] = useState(true); | ||
const [error, setError] = useState(""); | ||
|
||
const accountNumber = localStorage.getItem("accNo"); | ||
|
||
useEffect(() => { | ||
if (accountNumber) { | ||
axios | ||
.get(`https://localhost:443/api/payments/${accountNumber}`) | ||
.then((response) => { | ||
setTransactions(response.data); | ||
setLoading(false); | ||
}) | ||
.catch((error) => { | ||
console.error("Error fetching transactions:", error); | ||
setError("Error fetching transactions."); | ||
setLoading(false); | ||
}); | ||
} else { | ||
setError("Account number not found."); | ||
setLoading(false); | ||
} | ||
}, [accountNumber]); | ||
|
||
return ( | ||
<div> | ||
<h1>Transaction History</h1> | ||
{loading && <p>Loading...</p>} | ||
{error && <p>{error}</p>} | ||
{!loading && !error && ( | ||
<table border="1" cellPadding="10" cellSpacing="0"> | ||
<thead> | ||
<tr> | ||
<th>Amount</th> | ||
<th>Currency</th> | ||
<th>Provider</th> | ||
<th>Account Number</th> | ||
<th>SWIFT Code</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{transactions.length > 0 ? ( | ||
transactions.map((transaction) => ( | ||
<tr key={transaction.transactionId}> | ||
<td>{transaction.amount}</td> | ||
<td>{transaction.currency}</td> | ||
<td>{transaction.provider}</td> | ||
<td>{transaction.accountNumber}</td> | ||
<td>{transaction.swiftCode}</td> | ||
</tr> | ||
)) | ||
) : ( | ||
<tr> | ||
<td colSpan="6">No transactions found</td> | ||
</tr> | ||
)} | ||
</tbody> | ||
</table> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default History; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters