summaryrefslogtreecommitdiffstats
path: root/web/react/utils/client.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-22 13:18:42 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-22 13:18:42 -0700
commit6e60768abe6f0caa639febf068d718d62881ce62 (patch)
tree0600c72a7a9a3f7c1df167b3f870b38863e9a564 /web/react/utils/client.jsx
parente22e7b8b7b66f342c2df693bbfc06a85980d253e (diff)
parentac7918c5540900ab0dbe43d61b8c1155e4279b55 (diff)
downloadchat-6e60768abe6f0caa639febf068d718d62881ce62.tar.gz
chat-6e60768abe6f0caa639febf068d718d62881ce62.tar.bz2
chat-6e60768abe6f0caa639febf068d718d62881ce62.zip
Fixing merge conflict
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r--web/react/utils/client.jsx153
1 files changed, 98 insertions, 55 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index b01e2bb24..a19f58e61 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -57,7 +57,7 @@ export function createTeamFromSignup(teamSignup, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(teamSignup),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createTeamFromSignup', xhr, status, err);
error(e);
@@ -72,7 +72,7 @@ export function createTeamWithSSO(team, service, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(team),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createTeamWithSSO', xhr, status, err);
error(e);
@@ -87,7 +87,7 @@ export function createUser(user, data, emailHash, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(user),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createUser', xhr, status, err);
error(e);
@@ -104,7 +104,7 @@ export function updateUser(user, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(user),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateUser', xhr, status, err);
error(e);
@@ -121,7 +121,7 @@ export function updatePassword(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('newPassword', xhr, status, err);
error(e);
@@ -138,7 +138,7 @@ export function updateUserNotifyProps(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateUserNotifyProps', xhr, status, err);
error(e);
@@ -153,7 +153,7 @@ export function updateRoles(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateRoles', xhr, status, err);
error(e);
@@ -174,7 +174,7 @@ export function updateActive(userId, active, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateActive', xhr, status, err);
error(e);
@@ -191,7 +191,7 @@ export function sendPasswordReset(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('sendPasswordReset', xhr, status, err);
error(e);
@@ -208,7 +208,7 @@ export function resetPassword(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('resetPassword', xhr, status, err);
error(e);
@@ -252,7 +252,7 @@ export function revokeSession(altId, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({id: altId}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('revokeSession', xhr, status, err);
error(e);
@@ -267,7 +267,7 @@ export function getSessions(userId, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getSessions', xhr, status, err);
error(e);
@@ -281,7 +281,7 @@ export function getAudits(userId, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getAudits', xhr, status, err);
error(e);
@@ -380,7 +380,7 @@ export function inviteMembers(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('inviteMembers', xhr, status, err);
error(e);
@@ -397,7 +397,7 @@ export function updateTeamDisplayName(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateTeamDisplayName', xhr, status, err);
error(e);
@@ -414,7 +414,7 @@ export function signupTeam(email, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({email: email}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('singupTeam', xhr, status, err);
error(e);
@@ -431,7 +431,7 @@ export function createTeam(team, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(team),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createTeam', xhr, status, err);
error(e);
@@ -446,7 +446,7 @@ export function findTeamByName(teamName, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({name: teamName}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('findTeamByName', xhr, status, err);
error(e);
@@ -461,7 +461,7 @@ export function findTeamsSendEmail(email, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({email: email}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('findTeamsSendEmail', xhr, status, err);
error(e);
@@ -478,7 +478,7 @@ export function findTeams(email, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({email: email}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('findTeams', xhr, status, err);
error(e);
@@ -493,7 +493,7 @@ export function createChannel(channel, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(channel),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createChannel', xhr, status, err);
error(e);
@@ -510,7 +510,7 @@ export function createDirectChannel(channel, userId, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({user_id: userId}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createDirectChannel', xhr, status, err);
error(e);
@@ -527,7 +527,7 @@ export function updateChannel(channel, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(channel),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateChannel', xhr, status, err);
error(e);
@@ -544,7 +544,7 @@ export function updateChannelDesc(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateChannelDesc', xhr, status, err);
error(e);
@@ -561,7 +561,7 @@ export function updateNotifyLevel(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateNotifyLevel', xhr, status, err);
error(e);
@@ -575,7 +575,7 @@ export function joinChannel(id, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'POST',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('joinChannel', xhr, status, err);
error(e);
@@ -591,7 +591,7 @@ export function leaveChannel(id, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'POST',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('leaveChannel', xhr, status, err);
error(e);
@@ -607,7 +607,7 @@ export function deleteChannel(id, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'POST',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('deleteChannel', xhr, status, err);
error(e);
@@ -623,7 +623,7 @@ export function updateLastViewedAt(channelId, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'POST',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateLastViewedAt', xhr, status, err);
error(e);
@@ -637,7 +637,7 @@ export function getChannels(success, error) {
url: '/api/v1/channels/',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
ifModified: true,
error: function onError(xhr, status, err) {
var e = handleError('getChannels', xhr, status, err);
@@ -652,7 +652,7 @@ export function getChannel(id, success, error) {
url: '/api/v1/channels/' + id + '/',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getChannel', xhr, status, err);
error(e);
@@ -667,7 +667,7 @@ export function getMoreChannels(success, error) {
url: '/api/v1/channels/more',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
ifModified: true,
error: function onError(xhr, status, err) {
var e = handleError('getMoreChannels', xhr, status, err);
@@ -682,7 +682,7 @@ export function getChannelCounts(success, error) {
url: '/api/v1/channels/counts',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
ifModified: true,
error: function onError(xhr, status, err) {
var e = handleError('getChannelCounts', xhr, status, err);
@@ -696,7 +696,7 @@ export function getChannelExtraInfo(id, success, error) {
url: '/api/v1/channels/' + id + '/extra_info',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getChannelExtraInfo', xhr, status, err);
error(e);
@@ -711,7 +711,7 @@ export function executeCommand(channelId, command, suggest, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify({channelId: channelId, command: command, suggest: '' + suggest}),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('executeCommand', xhr, status, err);
error(e);
@@ -726,7 +726,7 @@ export function getPostsPage(channelId, offset, limit, success, error, complete)
dataType: 'json',
type: 'GET',
ifModified: true,
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getPosts', xhr, status, err);
error(e);
@@ -741,7 +741,7 @@ export function getPosts(channelId, since, success, error, complete) {
dataType: 'json',
type: 'GET',
ifModified: true,
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getPosts', xhr, status, err);
error(e);
@@ -757,7 +757,7 @@ export function getPost(channelId, postId, success, error) {
dataType: 'json',
type: 'GET',
ifModified: false,
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getPost', xhr, status, err);
error(e);
@@ -771,7 +771,7 @@ export function search(terms, success, error) {
dataType: 'json',
type: 'GET',
data: {terms: terms},
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('search', xhr, status, err);
error(e);
@@ -787,7 +787,7 @@ export function deletePost(channelId, id, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'POST',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('deletePost', xhr, status, err);
error(e);
@@ -804,7 +804,7 @@ export function createPost(post, channel, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(post),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('createPost', xhr, status, err);
error(e);
@@ -830,7 +830,7 @@ export function updatePost(post, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(post),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updatePost', xhr, status, err);
error(e);
@@ -847,7 +847,7 @@ export function addChannelMember(id, data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('addChannelMember', xhr, status, err);
error(e);
@@ -864,7 +864,7 @@ export function removeChannelMember(id, data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('removeChannelMember', xhr, status, err);
error(e);
@@ -881,7 +881,7 @@ export function getProfiles(success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
ifModified: true,
error: function onError(xhr, status, err) {
var e = handleError('getProfiles', xhr, status, err);
@@ -898,7 +898,7 @@ export function uploadFile(formData, success, error) {
cache: false,
contentType: false,
processData: false,
- success: success,
+ success,
error: function onError(xhr, status, err) {
if (err !== 'abort') {
var e = handleError('uploadFile', xhr, status, err);
@@ -918,7 +918,7 @@ export function getFileInfo(filename, success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getFileInfo', xhr, status, err);
error(e);
@@ -932,7 +932,7 @@ export function getPublicLink(data, success, error) {
dataType: 'json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getPublicLink', xhr, status, err);
error(e);
@@ -948,7 +948,7 @@ export function uploadProfileImage(imageData, success, error) {
cache: false,
contentType: false,
processData: false,
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('uploadProfileImage', xhr, status, err);
error(e);
@@ -964,7 +964,7 @@ export function importSlack(fileData, success, error) {
cache: false,
contentType: false,
processData: false,
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('importTeam', xhr, status, err);
error(e);
@@ -977,7 +977,7 @@ export function exportTeam(success, error) {
url: '/api/v1/teams/export_team',
type: 'GET',
dataType: 'json',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('exportTeam', xhr, status, err);
error(e);
@@ -991,7 +991,7 @@ export function getStatuses(success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getStatuses', xhr, status, err);
error(e);
@@ -1004,7 +1004,7 @@ export function getMyTeam(success, error) {
url: '/api/v1/teams/me',
dataType: 'json',
type: 'GET',
- success: success,
+ success,
ifModified: true,
error: function onError(xhr, status, err) {
var e = handleError('getMyTeam', xhr, status, err);
@@ -1020,7 +1020,7 @@ export function updateValetFeature(data, success, error) {
contentType: 'application/json',
type: 'POST',
data: JSON.stringify(data),
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('updateValetFeature', xhr, status, err);
error(e);
@@ -1053,7 +1053,7 @@ export function allowOAuth2(responseType, clientId, redirectUri, state, scope, s
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: (xhr, status, err) => {
const e = handleError('allowOAuth2', xhr, status, err);
error(e);
@@ -1062,3 +1062,46 @@ export function allowOAuth2(responseType, clientId, redirectUri, state, scope, s
module.exports.track('api', 'api_users_allow_oauth2');
}
+
+export function addIncomingHook(hook, success, error) {
+ $.ajax({
+ url: '/api/v1/hooks/incoming/create',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(hook),
+ success,
+ error: (xhr, status, err) => {
+ var e = handleError('addIncomingHook', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
+export function deleteIncomingHook(data, success, error) {
+ $.ajax({
+ url: '/api/v1/hooks/incoming/delete',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(data),
+ success,
+ error: (xhr, status, err) => {
+ var e = handleError('deleteIncomingHook', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
+export function listIncomingHooks(success, error) {
+ $.ajax({
+ url: '/api/v1/hooks/incoming/list',
+ dataType: 'json',
+ type: 'GET',
+ success,
+ error: (xhr, status, err) => {
+ var e = handleError('listIncomingHooks', xhr, status, err);
+ error(e);
+ }
+ });
+}