diff options
Diffstat (limited to 'webapp/actions')
-rw-r--r-- | webapp/actions/global_actions.jsx | 7 | ||||
-rw-r--r-- | webapp/actions/oauth_actions.jsx | 60 |
2 files changed, 60 insertions, 7 deletions
diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index ba92255ce..829424c1f 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -308,13 +308,6 @@ export function showLeaveTeamModal() { }); } -export function showRegisterAppModal() { - AppDispatcher.handleViewAction({ - type: ActionTypes.TOGGLE_REGISTER_APP_MODAL, - value: true - }); -} - export function emitSuggestionPretextChanged(suggestionId, pretext) { AppDispatcher.handleViewAction({ type: ActionTypes.SUGGESTION_PRETEXT_CHANGED, diff --git a/webapp/actions/oauth_actions.jsx b/webapp/actions/oauth_actions.jsx new file mode 100644 index 000000000..d2e5b0c98 --- /dev/null +++ b/webapp/actions/oauth_actions.jsx @@ -0,0 +1,60 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import Client from 'client/web_client.jsx'; +import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; +import Constants from 'utils/constants.jsx'; + +const ActionTypes = Constants.ActionTypes; + +export function listOAuthApps(userId, onSuccess, onError) { + Client.listOAuthApps( + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_OAUTHAPPS, + userId, + oauthApps: data + }); + + if (onSuccess) { + onSuccess(data); + } + }, + onError + ); +} + +export function deleteOAuthApp(id, userId, onSuccess, onError) { + Client.deleteOAuthApp( + id, + () => { + AppDispatcher.handleServerAction({ + type: ActionTypes.REMOVED_OAUTHAPP, + userId, + id + }); + + if (onSuccess) { + onSuccess(); + } + }, + onError + ); +} + +export function registerOAuthApp(app, onSuccess, onError) { + Client.registerOAuthApp( + app, + (data) => { + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_OAUTHAPP, + oauthApp: data + }); + + if (onSuccess) { + onSuccess(); + } + }, + onError + ); +}
\ No newline at end of file |