Skip to content

Commit

Permalink
fixed registration & shirts endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
N-A-V-I-D committed Apr 19, 2024
1 parent 412c5ff commit 535741e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
16 changes: 8 additions & 8 deletions back-end/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,14 @@ server.get('/shirts', auth, async (req, res) => {
user: userId,
articleType: 'Shirts'
});

// Check if shirts array is not empty
if (shirts.length > 0) {
res.json(shirts);
} else {
// If the array is empty, it may mean no shirts were found for the user
res.status(404).json({ message: 'No shirts found for this user.' });
}
res.json(shirts)
// // Check if shirts array is not empty
// if (shirts.length > 0) {
// res.json(shirts);
// } else {
// // If the array is empty, it may mean no shirts were found for the user
// res.status(404).json({ message: 'No shirts found for this user.' });
// }

} catch (error) {
console.error('Server error when fetching shirts:', error);
Expand Down
1 change: 1 addition & 0 deletions front-end/src/screens/Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function Registration(){
console.log(res.data.created);
if(res.data.created){
navigate('/home')
localStorage.setItem('token', res.data.token)
}
else{
setTakenUsername(true);
Expand Down

0 comments on commit 535741e

Please sign in to comment.