PLT-4572 - Move instances of Client.updateUser() in components to an action (#4571)
* Move instances of Client.updateUser() in components to an action
Этот коммит содержится в:
коммит произвёл
enahum
родитель
be74ec2241
Коммит
091e5b8e03
@@ -317,6 +317,24 @@ export function autocompleteUsersInTeam(username, success, error) {
|
||||
);
|
||||
}
|
||||
|
||||
export function updateUser(username, success, error) {
|
||||
Client.updateUser(
|
||||
username,
|
||||
(data) => {
|
||||
if (success) {
|
||||
success(data);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
AsyncClient.dispatchError(err, 'updateUser');
|
||||
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function generateMfaSecret(success, error) {
|
||||
Client.generateMfaSecret(
|
||||
(data) => {
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
|
||||
import SettingItemMax from '../setting_item_max.jsx';
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as I18n from 'i18n/i18n.jsx';
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import Constants from 'utils/constants.jsx';
|
||||
|
||||
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||
|
||||
import {updateUser} from 'actions/user_actions.jsx';
|
||||
import React from 'react';
|
||||
|
||||
export default class ManageLanguage extends React.Component {
|
||||
@@ -42,7 +41,7 @@ export default class ManageLanguage extends React.Component {
|
||||
this.submitUser(user);
|
||||
}
|
||||
submitUser(user) {
|
||||
Client.updateUser(user, Constants.UserUpdateEvents.LANGUAGE,
|
||||
updateUser(user, Constants.UserUpdateEvents.LANGUAGE,
|
||||
() => {
|
||||
GlobalActions.newLocalizationSelected(user.locale);
|
||||
},
|
||||
|
||||
@@ -15,6 +15,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'react-intl';
|
||||
import {updateUser} from 'actions/user_actions.jsx';
|
||||
|
||||
const holders = defineMessages({
|
||||
usernameReserved: {
|
||||
@@ -187,7 +188,7 @@ class UserSettingsGeneralTab extends React.Component {
|
||||
}
|
||||
|
||||
submitUser(user, type, emailUpdated) {
|
||||
Client.updateUser(user, type,
|
||||
updateUser(user, type,
|
||||
() => {
|
||||
this.updateSection('');
|
||||
AsyncClient.getMe();
|
||||
|
||||
Ссылка в новой задаче
Block a user