refactor: Use beforeRequest hook with slack app

This commit is contained in:
Faruk AYDIN
2022-10-18 23:01:56 +02:00
parent 3004cf1115
commit 7422f63c62
6 changed files with 24 additions and 20 deletions

View File

@@ -8,10 +8,6 @@ type FindMessageOptions = {
};
const findMessage = async ($: IGlobalVariable, options: FindMessageOptions) => {
const headers = {
Authorization: `Bearer ${$.auth.data.accessToken}`,
};
const params = {
query: options.query,
sort: options.sortBy,
@@ -20,7 +16,6 @@ const findMessage = async ($: IGlobalVariable, options: FindMessageOptions) => {
};
const response = await $.http.get('/search.messages', {
headers,
params,
});

View File

@@ -5,16 +5,12 @@ const postMessage = async (
channelId: string,
text: string
) => {
const headers = {
Authorization: `Bearer ${$.auth.data.accessToken}`,
};
const params = {
channel: channelId,
text,
};
const response = await $.http.post('/chat.postMessage', params, { headers });
const response = await $.http.post('/chat.postMessage', params);
const message: IActionOutput = {
data: {