Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update User_UploadAvatar to take in a file instead of a base64 image #1966

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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