* Remove mattermost-redux * Move mm-redux files into app/redux * Add @redux path to tsconfig.json * Fix imports * Install missing dependencies * Fix tsc errors * Fix i18n_utils test * Fix more imports * Remove redux websocket * Fix tests * Rename @redux * Apply changes from mattermost-redux PR 1103 * Remove mattermost-redux mention in template * Add missing imports * Rename app/redux/ to app/mm-redux/ * Remove test file * Fix fetching Sidebar GM profiles Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
39 lines
1 KiB
JavaScript
39 lines
1 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));
|
|
return result;
|
|
};
|
|
}
|
|
|
|
export default {
|
|
updateUser,
|
|
setProfileImageUri,
|
|
removeProfileImage,
|
|
};
|