Skip to content

Commit 570985f

Browse files
committed
remove usage of fpts from alerts
1 parent c6876e4 commit 570985f

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

x-pack/plugins/alerts/public/alert_api.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
*/
66

77
import { HttpSetup } from 'kibana/public';
8-
import { findFirst } from 'fp-ts/lib/Array';
9-
import { isNone } from 'fp-ts/lib/Option';
10-
118
import { i18n } from '@kbn/i18n';
129
import { BASE_ALERT_API_PATH } from '../common';
13-
import { Alert, AlertType } from '../common';
10+
import type { Alert, AlertType } from '../common';
1411

1512
export async function loadAlertTypes({ http }: { http: HttpSetup }): Promise<AlertType[]> {
1613
return await http.get(`${BASE_ALERT_API_PATH}/list_alert_types`);
@@ -23,10 +20,10 @@ export async function loadAlertType({
2320
http: HttpSetup;
2421
id: AlertType['id'];
2522
}): Promise<AlertType> {
26-
const maybeAlertType = findFirst<AlertType>((type) => type.id === id)(
27-
await http.get(`${BASE_ALERT_API_PATH}/list_alert_types`)
28-
);
29-
if (isNone(maybeAlertType)) {
23+
const maybeAlertType = ((await http.get(
24+
`${BASE_ALERT_API_PATH}/list_alert_types`
25+
)) as AlertType[]).find((type) => type.id === id);
26+
if (!maybeAlertType) {
3027
throw new Error(
3128
i18n.translate('xpack.alerts.loadAlertType.missingAlertTypeError', {
3229
defaultMessage: 'Alert type "{id}" is not registered.',
@@ -36,7 +33,7 @@ export async function loadAlertType({
3633
})
3734
);
3835
}
39-
return maybeAlertType.value;
36+
return maybeAlertType;
4037
}
4138

4239
export async function loadAlert({

0 commit comments

Comments
 (0)