summaryrefslogtreecommitdiffstats
path: root/web/react/utils/client.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-01-04 15:55:51 -0500
committerChristopher Speller <crspeller@gmail.com>2016-01-04 15:55:51 -0500
commit67db3ca8ce5e78ee55c37a3dbfb8e5d44037a324 (patch)
tree6ffac556a09192e7042d7ab2c184382286338c90 /web/react/utils/client.jsx
parent07efe758609929e662185199e8c5a273b0fb0007 (diff)
parenta6ae90ac2a74871331707751e823b4746136ff09 (diff)
downloadchat-67db3ca8ce5e78ee55c37a3dbfb8e5d44037a324.tar.gz
chat-67db3ca8ce5e78ee55c37a3dbfb8e5d44037a324.tar.bz2
chat-67db3ca8ce5e78ee55c37a3dbfb8e5d44037a324.zip
Merge pull request #1745 from mattermost/plt-1118
PLT-1118 Add ability to switch between SSO and email account
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r--web/react/utils/client.jsx34
1 files changed, 34 insertions, 0 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 8a4cee589..e1c331aff 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -228,6 +228,40 @@ export function resetPassword(data, success, error) {
track('api', 'api_users_reset_password');
}
+export function switchToSSO(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/switch_to_sso',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('switchToSSO', xhr, status, err);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_switch_to_sso');
+}
+
+export function switchToEmail(data, success, error) {
+ $.ajax({
+ url: '/api/v1/users/switch_to_email',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('switchToEmail', xhr, status, err);
+ error(e);
+ }
+ });
+
+ track('api', 'api_users_switch_to_email');
+}
+
export function logout() {
track('api', 'api_users_logout');
var currentTeamUrl = TeamStore.getCurrentTeamUrl();