diff --git a/backend/models/User.js b/backend/models/User.js index e14471e..3fc2043 100644 --- a/backend/models/User.js +++ b/backend/models/User.js @@ -7,7 +7,7 @@ const UserSchema = new Schema({ password: String, followers: Array, following: Array, - profileImageKey: String, + profileImageKey: {type: String, default: ''}, publicId: String, hideFollowing: {type: Boolean, default: false}, hideFollowers: {type: Boolean, default: false} diff --git a/frontend/src/routes/HistoryViewer.js b/frontend/src/routes/HistoryViewer.js index 500c436..d97eed9 100644 --- a/frontend/src/routes/HistoryViewer.js +++ b/frontend/src/routes/HistoryViewer.js @@ -39,7 +39,7 @@ const HistoryViewer = () => { const {profileData, editHistory, currentPost} = result; if (currentPost.imageKey) currentPost.image = ('data:image/jpeg;base64,' + (await axios.get(`${serverUrl}/image/${currentPost.imageKey}`)).data) - profileData.profilePicture = profileData.profileImageKey !== '' ? ('data:image/jpeg;base64,' + (await axios.get(`${serverUrl}/image/${profileData.profileImageKey}`)).data) : defaultPfp + profileData.profilePicture = profileData?.profileImageKey && profileData?.profileImageKey !== '' ? ('data:image/jpeg;base64,' + (await axios.get(`${serverUrl}/image/${profileData.profileImageKey}`)).data) : defaultPfp setCurrentPost(currentPost) setEditHistory(editHistory.sort((a,b) => b.dateMade - a.dateMade)) setProfileData(profileData)