diff options
author | =Corey Hulen <corey@hulen.com> | 2016-02-04 10:55:44 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-02-04 10:55:44 -0800 |
commit | cfd4e4de963703191e750ba0abb901c5f6c0c3e4 (patch) | |
tree | d01a656eeeaba9603568a54a164f378608c4a939 /web/react/utils/client.jsx | |
parent | f1bf70624288bd192b9523764f239eee2a022304 (diff) | |
parent | 44c19ee443831e0e94b5738ecb21a64ce7643247 (diff) | |
download | chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.gz chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.bz2 chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.zip |
Merge branch 'master' into PLT-1851
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r-- | web/react/utils/client.jsx | 76 |
1 files changed, 74 insertions, 2 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx index 33eb4cd47..992337671 100644 --- a/web/react/utils/client.jsx +++ b/web/react/utils/client.jsx @@ -908,11 +908,11 @@ export function getChannelExtraInfo(id, memberLimit, success, error) { export function executeCommand(channelId, command, suggest, success, error) { $.ajax({ - url: '/api/v1/command', + url: '/api/v1/commands/execute', dataType: 'json', contentType: 'application/json', type: 'POST', - data: JSON.stringify({channelId: channelId, command: command, suggest: '' + suggest}), + data: JSON.stringify({channelId, command, suggest: '' + suggest}), success, error: function onError(xhr, status, err) { var e = handleError('executeCommand', xhr, status, err); @@ -921,6 +921,78 @@ export function executeCommand(channelId, command, suggest, success, error) { }); } +export function addCommand(cmd, success, error) { + $.ajax({ + url: '/api/v1/commands/create', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(cmd), + success, + error: (xhr, status, err) => { + var e = handleError('addCommand', xhr, status, err); + error(e); + } + }); +} + +export function deleteCommand(data, success, error) { + $.ajax({ + url: '/api/v1/commands/delete', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('deleteCommand', xhr, status, err); + error(e); + } + }); +} + +export function listTeamCommands(success, error) { + $.ajax({ + url: '/api/v1/commands/list_team_commands', + dataType: 'json', + type: 'GET', + success, + error: (xhr, status, err) => { + var e = handleError('listTeamCommands', xhr, status, err); + error(e); + } + }); +} + +export function regenCommandToken(data, success, error) { + $.ajax({ + url: '/api/v1/commands/regen_token', + dataType: 'json', + contentType: 'application/json', + type: 'POST', + data: JSON.stringify(data), + success, + error: (xhr, status, err) => { + var e = handleError('regenCommandToken', xhr, status, err); + error(e); + } + }); +} + +export function listCommands(success, error) { + $.ajax({ + url: '/api/v1/commands/list', + dataType: 'json', + contentType: 'application/json', + type: 'GET', + success, + error: function onError(xhr, status, err) { + var e = handleError('listCommands', xhr, status, err); + error(e); + } + }); +} + export function getPostsPage(channelId, offset, limit, success, error, complete) { $.ajax({ cache: false, |