forked from Ivasoft/mattermost-mobile
* Add set status feature Small code refactoring Add Do Not Disturb option * Add Account Settings screen Add username, nicname, and position fields Add email field get deviceHeight from redux Clean up onPress handler in Settings Refactor each account settings item to it's own component Clean up email field and updateUser action method Use mobile localization format in en.json Update profile image Clean up ProfilePicture for editing Add loading and error components in AccountSettings Refactor updateRequest state into a function Follow design specs Remove unnecessary this.state.emailUpdated Polish AccountSettings and secondary components Refactor AttachmentButton into it's own componentg Add Account Settings icon in General Settings Add TODO comments * Update user status * Edit Profile screen refactored * Fix edit profile item text color
26 lines
879 B
JavaScript
26 lines
879 B
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import {uploadProfileImage, updateMe} from 'mattermost-redux/actions/users';
|
|
import {buildFileUploadData} from 'app/utils/file';
|
|
|
|
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 handleUploadProfileImage(image, userId) {
|
|
return async (dispatch, getState) => {
|
|
const imageData = buildFileUploadData(image);
|
|
return await uploadProfileImage(userId, imageData)(dispatch, getState);
|
|
};
|
|
}
|