Skip to content

Commit

Permalink
Fix some issues with profile persistance
Browse files Browse the repository at this point in the history
  • Loading branch information
Spyboticsguy committed Feb 17, 2018
1 parent d41cebf commit 1f50581
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/model/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class Auth {
/**
* Takes in an old item from the user and the new data to update the user's data to the new data.
*/
updateAccountItem(userItem, newData) {
StudyBuddyDB.updateUserItem(userItem, newData);
updateUser(email, newUser) {
StudyBuddyDB.updateUser(email, newUser);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/model/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Database {
/**
* This method updates the user's data according to their changes.
*/
updateUserItem(key, data) {
AsyncStorage.setItem(key, data);
updateUser(email, newUser) {
AsyncStorage.setItem(email, JSON.stringify(newUser));
}

}
Expand Down
6 changes: 1 addition & 5 deletions src/pages/EditProfileScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ export default class EditProfileScreen extends React.Component {
user.bio = this.state.bio;
user.major = value.major;
user.year = value.year;
AuthObject.updateAccountItem(user.name, this.state.fname);
AuthObject.updateAccountItem(user.lastName, this.state.lname);
AuthObject.updateAccountItem(user.bio, this.state.bio);
AuthObject.updateAccountItem(user.major, value.major);
AuthObject.updateAccountItem(user.year, value.year);
AuthObject.updateUser(user.email, user);
console.log(user);
navigate('MyProfile');
}
Expand Down

0 comments on commit 1f50581

Please sign in to comment.