diff --git a/README.md b/README.md
index cb29629..2113b5c 100644
--- a/README.md
+++ b/README.md
@@ -188,6 +188,6 @@ Also I would like to thank [Murat Korkmaz](https://www.behance.net/muratk) on Be
## 📝 License
-This project is [MIT](https://github.com/tsheporamantso/final-capstone-react-front-end/blob/1012050f1dd1a177d317f0a8c3b90ab76d956a7f/LICENSE) licensed.
+This project is [MIT](./LICENSE) licensed.
(back to top )
diff --git a/src/Components/AddReservation.js b/src/Components/AddReservation.js
index 0c841e1..7deb34b 100644
--- a/src/Components/AddReservation.js
+++ b/src/Components/AddReservation.js
@@ -21,6 +21,7 @@ function AddReservation() {
const [numberOfDays, setNumberOfDays] = useState(0);
const status = useSelector((state) => state.addReservation.status);
const error = useSelector((state) => state.addReservation.error);
+ const [errorMessage, setErrorMessage] = useState('');
const fetchPlaces = async (userId) => {
try {
@@ -28,7 +29,7 @@ function AddReservation() {
const data = await response.json();
setPlaces(data);
} catch (error) {
- console.error('Error fetching places:', error);
+ setErrorMessage('Invalid Email or password.');
}
};
@@ -77,6 +78,7 @@ function AddReservation() {
}}
>
Add Reservation
+ {errorMessage && {errorMessage}
}
diff --git a/src/Components/UserAuth.js b/src/Components/UserAuth.js
index 7ffc2e4..7bc3f38 100644
--- a/src/Components/UserAuth.js
+++ b/src/Components/UserAuth.js
@@ -12,10 +12,8 @@ function UserAuth({ setLoggedIn }) {
const handleSubmit = async (e) => {
e.preventDefault();
- console.log('Form data:', { email, password });
try {
- console.log('Submitting sign in form...');
const response = await axios.post('http://localhost:3000/users/sign_in', {
user: {
email,
@@ -23,26 +21,16 @@ function UserAuth({ setLoggedIn }) {
},
});
- console.log('Response Data:', response.data);
-
- console.log('I want the User ID', response.data.status.data.id);
-
if (response.status === 200) {
localStorage.setItem('authToken', response.data.token);
localStorage.setItem('userId', response.data.status.data.id);
- const userId = localStorage.getItem('userId');
- console.log('User ID from local storage:', userId);
-
setLoggedIn(true);
navigate('/layout/placelist');
} else {
- console.error('Unexpected response status:', response.status);
setErrorMessage('Invalid Email or password.');
}
} catch (error) {
- console.log('Error:', error.response.data);
- console.error('Axios error:', error);
setErrorMessage('Invalid Email or password.');
}
};
@@ -52,7 +40,6 @@ function UserAuth({ setLoggedIn }) {
Sign In
{errorMessage && {errorMessage}
}
{' '}
- {/* Display error message */}