summaryrefslogtreecommitdiffstats
path: root/webapp/actions/oauth_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/oauth_actions.jsx')
-rw-r--r--webapp/actions/oauth_actions.jsx60
1 files changed, 60 insertions, 0 deletions
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