Skip to content

Commit

Permalink
Merge pull request #1966 from Expensify/nikki-cash-avatar-file
Browse files Browse the repository at this point in the history
Update User_UploadAvatar to take in a file instead of a base64 image
  • Loading branch information
thienlnam authored Mar 24, 2021
2 parents 8d44a22 + 7b002ea commit 6febd9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,12 @@ function User_SecondaryLogin_Send(parameters) {

/**
* @param {Object} parameters
* @param {String} parameters.base64image
* @param {File|Object} parameters.file
* @returns {Promise}
*/
function User_UploadAvatar(parameters) {
const commandName = 'User_UploadAvatar';
requireParameters(['base64image'], parameters, commandName);
requireParameters(['file'], parameters, commandName);
return Network.post(commandName, parameters);
}

Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ function setPersonalDetails(details) {
/**
* Sets the user's avatar image
*
* @param {String} base64image
* @param {File|Object} file
*/
function setAvatar(base64image) {
API.User_UploadAvatar({base64image}).then((response) => {
function setAvatar(file) {
API.User_UploadAvatar({file}).then((response) => {
// Once we get the s3url back, update the personal details for the user with the new avatar URL
if (response.jsonCode === 200) {
setPersonalDetails({avatar: response.s3url});
Expand Down

0 comments on commit 6febd9a

Please sign in to comment.