refactor: Use global output with slack actions

This commit is contained in:
Faruk AYDIN
2022-10-21 19:21:14 +02:00
parent 00be50d2fd
commit 585adb14e6
2 changed files with 7 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import { IGlobalVariable, IActionOutput } from '@automatisch/types';
import { IGlobalVariable } from '@automatisch/types';
const postMessage = async (
$: IGlobalVariable,
@@ -12,18 +12,11 @@ const postMessage = async (
const response = await $.http.post('/chat.postMessage', params);
const message: IActionOutput = {
data: {
raw: response?.data?.message,
},
error: response?.httpError,
};
if (response.data.ok === false) {
message.error = response.data;
throw new Error(JSON.stringify(response.data));
}
return message;
$.actionOutput.data.raw = response?.data?.message;
};
export default postMessage;