Fixing editProfile bugs and making the database storage more efficient

This commit is contained in:
Clayton Wilson
2019-10-24 15:44:53 -04:00
parent b17fb1f3f0
commit 8f5020f881
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) => {