Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
catherinepapad committed Jan 1, 2024
2 parents abdfde6 + 59e9872 commit 5519316
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion web-app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ router.post('/register', async (req, res) => {
console.log("User data:");
console.log(userData);

if (userData != undefined && userData.error == undefined) {
if (userData == undefined) {
res.send("There was an error with your registration");
}
else if (userData.error == undefined) {
req.session.Username = username;
res.redirect('/');
}
Expand Down
6 changes: 5 additions & 1 deletion web-app/src/builder-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ document.addEventListener('DOMContentLoaded', function () {
const selectedStorageId = dropdown.value;
const selectedStorageName = data[selectedStorageId].name;

// Add the value to the array
// Add the value to the array only if it doesn't exist
if (storageIdArray.includes(selectedStorageId)) {
alert('This storage is already added.');
return;
}
storageIdArray.push(selectedStorageId);
storageNameArray.push(selectedStorageName);

Expand Down
3 changes: 3 additions & 0 deletions web-app/src/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ document.addEventListener('DOMContentLoaded', function () {
.then(data => {
// Handle the response data
console.log('Response data:', data);
alert("Build saved successfully!");
window.location.href = '/';
})
.catch(error => {
// Handle errors
console.error('Error:', error);
alert("There was an error saving your build");
});

});
Expand Down

0 comments on commit 5519316

Please sign in to comment.