in this PR feat(client): change setting alert messages to more descriptive messages by Sboonny · Pull Request #49396 · freeCodeCamp/freeCodeCamp (github.com), I tried to change the alert message into something more descriptive.
The issue is that changing the alert message broke the save API for privacy, as shown in the gif below.
Notes:
- it saves the new change in the database.
- it succeed the API call when press save.
- it still shows error message, with the success.
here is the old function code
const updatePrivacyTerms = (req, res, next) => {
const {
user,
body: { quincyEmails }
} = req;
const update = {
acceptedPrivacyTerms: true,
sendQuincyEmail: !!quincyEmails
};
return user.updateAttributes(update, err => {
if (err) {
res.status(500).json(standardErrorMessage);
return next(err);
}
return res.status(200).json(standardSuccessMessage);
});
};
The change I did is adding a parameter to createUpdateUserProperties
.
function createUpdateUserProperties(buildUpdate, validate, successMessage)