Files
mattermost-mobile/app/actions/views/edit_profile.js
Mattermost Build da575c7cb1 1.45 Release testing bug fixes (#5529) (#5536)
* MM-36908 display unicode emoji in text field after selecting from autocomple

* MM-36935 Fix android crash when ammending search in Sidebar Jump to

* MM-36929 & MM-36928 fix notification badge resetting on new notification

* MM-36920 Fix android push notification issues

* MM-36922 Edit profile image

* Fix crash when opening Android test notification

(cherry picked from commit 78156ee75b)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2021-07-12 16:13:54 -04:00

41 lines
1.0 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {updateMe, setDefaultProfileImage} from '@mm-redux/actions/users';
import {ViewTypes} from 'app/constants';
export function updateUser(user, success, error) {
return async (dispatch, getState) => {
const result = await updateMe(user)(dispatch, getState);
const {data, error: err} = result;
if (data && success) {
success(data);
} else if (err && error) {
error({id: err.server_error_id, ...err});
}
return result;
};
}
export function setProfileImageUri(imageUri = '') {
return {
type: ViewTypes.SET_PROFILE_IMAGE_URI,
imageUri,
};
}
export function removeProfileImage(user) {
return async (dispatch) => {
const result = await dispatch(setDefaultProfileImage(user));
dispatch(setProfileImageUri());
return result;
};
}
export default {
updateUser,
setProfileImageUri,
removeProfileImage,
};