summaryrefslogtreecommitdiffstats
path: root/web/react/utils/client.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-14 10:52:14 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-14 10:52:14 -0600
commit586967b757a869dbb5f3677e605009a1f5c61005 (patch)
tree7744da13bb6de117de40a7e6ab71df620a6a7b46 /web/react/utils/client.jsx
parent6d6cada0970a2b341f36dac9b0fed8262ada1865 (diff)
downloadchat-586967b757a869dbb5f3677e605009a1f5c61005.tar.gz
chat-586967b757a869dbb5f3677e605009a1f5c61005.tar.bz2
chat-586967b757a869dbb5f3677e605009a1f5c61005.zip
finishing up commands UI
Diffstat (limited to 'web/react/utils/client.jsx')
-rw-r--r--web/react/utils/client.jsx60
1 files changed, 59 insertions, 1 deletions
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index 9ff76f824..07982b7be 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -850,7 +850,7 @@ export function executeCommand(channelId, command, suggest, success, error) {
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);
@@ -859,6 +859,64 @@ 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',