From 535741ec0ae48a52400bb53a8dde5481a8e19201 Mon Sep 17 00:00:00 2001 From: N-A-V-I-D Date: Thu, 18 Apr 2024 20:16:43 -0400 Subject: [PATCH] fixed registration & shirts endpoint --- back-end/server.js | 16 ++++++++-------- front-end/src/screens/Registration.js | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/back-end/server.js b/back-end/server.js index f93e5e8..b40ddb8 100644 --- a/back-end/server.js +++ b/back-end/server.js @@ -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); diff --git a/front-end/src/screens/Registration.js b/front-end/src/screens/Registration.js index 13de219..fd7b6ba 100644 --- a/front-end/src/screens/Registration.js +++ b/front-end/src/screens/Registration.js @@ -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);