Skip to content

Commit

Permalink
API fixes
Browse files Browse the repository at this point in the history
API fix 3 billion and 5
  • Loading branch information
ShalomShrek committed Nov 11, 2024
1 parent 836b44d commit 5c69018
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion API/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ app.post("/api/auth/login", async (req, res) => {
.json({ message: "Invalid credentials. Incorrect password." });
}

res.status(200).json({ message: "Login successful", userType: user.userType });
res.status(200).json({ message: "Login successful", userType: user.userType, id: user.id });
} catch (error) {
console.error("Error logging in:", error);
return res.status(500).json({ message: "Error logging in" });
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const History = () => {
const [error, setError] = useState("");
const navigate = useNavigate();
const [message, setMessage] = useState("");
const accountNumber = localStorage.getItem("accNo");
const accountNumber = localStorage.getItem("id");
const userType = localStorage.getItem("userType");

useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion Frontend/src/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function Login() {
if (response.ok) {
localStorage.setItem("accNo", accountNumber);
localStorage.setItem("userType", data.userType);
localStorage.setItem("id", data.id)
setMessage("Login successful!");

if (data.userType === "Employee") {
Expand All @@ -53,7 +54,7 @@ function Login() {
};

return (
<div className="card">
<div className="card" style={{ backgroundColor: 'lightblue' }}>
<h2>Login</h2>
<form onSubmit={handleLogin}>
<input type="text" name="accountNumber" placeholder="Account Number" required />
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/Payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function Payments() {
};

return (
<div className="card">
<div className="card" style={{ backgroundColor: 'lightblue' }}>
<h2>Make a Payment</h2>
<form onSubmit={handlePayment}>
<input type="number" placeholder="Amount" required />
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Register() {
};

return (
<div className="card">
<div className="card" style={{ backgroundColor: 'lightblue' }}>
<h2>Create an Account</h2>
<form onSubmit={handleRegister}>
<input type="text" placeholder="Full Name" required />
Expand Down

0 comments on commit 5c69018

Please sign in to comment.