Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { SEARCH_TRIGGER } from "../../../../constants/index.ts"; import { apiSlice } from "../../../app/apiSlice.ts"; import { store } from "../../../index.ts"; import { currentWorkflowSelector } from "../../workflow/workflowSlice.ts"; const currentTimestamp = Math.floor(Date.now() / 1000); export const searchTriggerApi = apiSlice.injectEndpoints({ endpoints: (builder) => ({ getSearchTriggers: builder.query<any, number | void>({ query: (limit) => { const currentWorkflow = currentWorkflowSelector(store.getState()); const workspace_id = currentWorkflow?.trigger?.workspaceId; const channel_id = currentWorkflow?.trigger?.channel?.channel_id; const alert_type = currentWorkflow?.trigger?.source; const filter_string = currentWorkflow?.trigger?.filterString; return { url: SEARCH_TRIGGER, method: "POST", body: { meta: { page: { limit: limit ?? 5, offset: 0, }, time_range: { time_geq: currentTimestamp - 259200, time_lt: currentTimestamp, }, }, workspace_id, channel_id, alert_type, pattern: filter_string, }, }; }, transformResponse: (response: any) => { const data = { alerts: response?.slack_alerts ?? [], total: response?.meta?.total_count ?? 0, }; return data; }, }), }), }); export const { useGetSearchTriggersQuery, useLazyGetSearchTriggersQuery } = searchTriggerApi; |