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) {
|
export function generateMfaSecret(success, error) {
|
||||||
Client.generateMfaSecret(
|
Client.generateMfaSecret(
|
||||||
(data) => {
|
(data) => {
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
import SettingItemMax from '../setting_item_max.jsx';
|
import SettingItemMax from '../setting_item_max.jsx';
|
||||||
|
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import * as I18n from 'i18n/i18n.jsx';
|
import * as I18n from 'i18n/i18n.jsx';
|
||||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
import {FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||||
|
import {updateUser} from 'actions/user_actions.jsx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export default class ManageLanguage extends React.Component {
|
export default class ManageLanguage extends React.Component {
|
||||||
@@ -42,7 +41,7 @@ export default class ManageLanguage extends React.Component {
|
|||||||
this.submitUser(user);
|
this.submitUser(user);
|
||||||
}
|
}
|
||||||
submitUser(user) {
|
submitUser(user) {
|
||||||
Client.updateUser(user, Constants.UserUpdateEvents.LANGUAGE,
|
updateUser(user, Constants.UserUpdateEvents.LANGUAGE,
|
||||||
() => {
|
() => {
|
||||||
GlobalActions.newLocalizationSelected(user.locale);
|
GlobalActions.newLocalizationSelected(user.locale);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import * as AsyncClient from 'utils/async_client.jsx';
|
|||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'react-intl';
|
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage, FormattedDate} from 'react-intl';
|
||||||
|
import {updateUser} from 'actions/user_actions.jsx';
|
||||||
|
|
||||||
const holders = defineMessages({
|
const holders = defineMessages({
|
||||||
usernameReserved: {
|
usernameReserved: {
|
||||||
@@ -187,7 +188,7 @@ class UserSettingsGeneralTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
submitUser(user, type, emailUpdated) {
|
submitUser(user, type, emailUpdated) {
|
||||||
Client.updateUser(user, type,
|
updateUser(user, type,
|
||||||
() => {
|
() => {
|
||||||
this.updateSection('');
|
this.updateSection('');
|
||||||
AsyncClient.getMe();
|
AsyncClient.getMe();
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user