summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webapp/actions/channel_actions.jsx18
-rw-r--r--webapp/components/rename_channel_modal.jsx7
2 files changed, 20 insertions, 5 deletions
diff --git a/webapp/actions/channel_actions.jsx b/webapp/actions/channel_actions.jsx
index ae32a481b..b108633d7 100644
--- a/webapp/actions/channel_actions.jsx
+++ b/webapp/actions/channel_actions.jsx
@@ -210,6 +210,24 @@ export function joinChannel(channel, success, error) {
);
}
+export function updateChannel(channel, success, error) {
+ Client.updateChannel(
+ channel,
+ () => {
+ AsyncClient.getChannel(channel.id);
+
+ if (success) {
+ success();
+ }
+ },
+ (err) => {
+ if (error) {
+ error(err);
+ }
+ }
+ );
+}
+
export function searchMoreChannels(term, success, error) {
Client.searchMoreChannels(
term,
diff --git a/webapp/components/rename_channel_modal.jsx b/webapp/components/rename_channel_modal.jsx
index bb6d4f26d..3eaab834f 100644
--- a/webapp/components/rename_channel_modal.jsx
+++ b/webapp/components/rename_channel_modal.jsx
@@ -3,11 +3,10 @@
import ReactDOM from 'react-dom';
import * as Utils from 'utils/utils.jsx';
-import Client from 'client/web_client.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
import Constants from 'utils/constants.jsx';
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
+import {updateChannel} from 'actions/channel_actions.jsx';
import {Modal} from 'react-bootstrap';
@@ -161,10 +160,8 @@ export class RenameChannelModal extends React.Component {
return;
}
- Client.updateChannel(
- channel,
+ updateChannel(channel,
() => {
- AsyncClient.getChannel(channel.id);
this.handleHide();
},
(err) => {