Merge pull request #35 from ClaytonWWilson/edit-profile-fix

Fixing editProfile bugs and making the database storage more efficient
This commit is contained in:
2019-10-24 19:32:05 -04:00
committed by GitHub
3 changed files with 35 additions and 11 deletions

View File

@@ -88,6 +88,14 @@ export class edit extends Component {
handle: this.state.handle,
bio: this.state.bio
};
// Removes all keys from newProfileData that are empty, undefined, or null
Object.keys(newProfileData).forEach(key => {
if (newProfileData[key] === "" || newProfileData[key] === undefined || newProfileData[key] === null) {
delete newProfileData[key];
}
})
axios
.post("/updateProfileInfo", newProfileData)
.then((res) => {