packages/core: split alerting functionality out from ErrorApiForwarder into ErrorAlerter

This commit is contained in:
Patrik Oldsberg
2020-05-25 22:07:54 +02:00
parent 4e7e0833cc
commit 5c7d263aa8
5 changed files with 47 additions and 13 deletions
+3 -2
View File
@@ -55,15 +55,16 @@ import {
errorApiRef,
AlertApiForwarder,
ErrorApiForwarder,
ErrorAlerter,
} from '@backstage/core';
const builder = ApiRegistry.builder();
// The alert API is a self-contained implementation that shows alerts to the user.
builder.add(alertApiRef, new AlertApiForwarder());
const alertApi = builder.add(alertApiRef, new AlertApiForwarder());
// The error API uses the alert API to send error notifications to the user.
builder.add(errorApiRef, new ErrorApiForwarder(alertApiForwarder));
builder.add(errorApiRef, new ErrorAlerter(alertApi, new ErrorApiForwarder()));
const app = createApp({
apis: apiBuilder.build(),