Move integrations over to redux and v4 (#6679)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
1594cf8af1
Коммит
ef9326bcbb
@@ -1,16 +1,18 @@
|
||||
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
|
||||
import {clientLogout} from 'actions/global_actions.jsx';
|
||||
|
||||
import Client from 'client/web_client.jsx';
|
||||
|
||||
import store from 'stores/redux_store.jsx';
|
||||
const dispatch = store.dispatch;
|
||||
const getState = store.getState;
|
||||
|
||||
import * as AdminActions from 'mattermost-redux/actions/admin';
|
||||
import * as UserActions from 'mattermost-redux/actions/users';
|
||||
import * as IntegrationActions from 'mattermost-redux/actions/integrations';
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
|
||||
export function saveConfig(config, success, error) {
|
||||
AdminActions.updateConfig(config)(dispatch, getState).then(
|
||||
@@ -157,13 +159,13 @@ export function ldapSyncNow(success, error) {
|
||||
}
|
||||
|
||||
export function getOAuthAppInfo(clientId, success, error) {
|
||||
Client.getOAuthAppInfo(
|
||||
clientId,
|
||||
Client4.getOAuthAppInfo(clientId).then(
|
||||
(data) => {
|
||||
if (success) {
|
||||
success(data);
|
||||
}
|
||||
},
|
||||
}
|
||||
).catch(
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
@@ -179,12 +181,13 @@ export function allowOAuth2(params, success, error) {
|
||||
const state = params.state;
|
||||
const scope = params.scope;
|
||||
|
||||
Client.allowOAuth2(responseType, clientId, redirectUri, state, scope,
|
||||
Client4.authorizeOAuthApp(responseType, clientId, redirectUri, state, scope).then(
|
||||
(data) => {
|
||||
if (success) {
|
||||
success(data);
|
||||
}
|
||||
},
|
||||
}
|
||||
).catch(
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
@@ -238,16 +241,13 @@ export function oauthToEmail(currentService, email, password, success, error) {
|
||||
}
|
||||
|
||||
export function regenerateOAuthAppSecret(oauthAppId, success, error) {
|
||||
Client.regenerateOAuthAppSecret(
|
||||
oauthAppId,
|
||||
IntegrationActions.regenOAuthAppSecret(oauthAppId)(dispatch, getState).then(
|
||||
(data) => {
|
||||
if (success) {
|
||||
if (data && success) {
|
||||
success(data);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
} else if (data == null && error) {
|
||||
const serverError = getState().requests.admin.updateOAuthApp.error;
|
||||
error({id: serverError.server_error_id, ...serverError});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Ссылка в новой задаче
Block a user