Atomic Angular — Doc interne

Notify failed requests as toasts

Surface a failed backend request as a toast notification, without wrapping Angular's HttpClient.

provideAtomicNotifications() subscribes to the client's own requestFailed event and raises a toast for the statuses worth telling the user about, replacing the retired toastInterceptorFn.

Minimal example

Registered alongside the client
app.config.ts
import { ApplicationConfig } from "@angular/core";
import { provideAtomicClient, provideAtomicNotifications } from "@sinequa/atomic-angular";

export const appConfig: ApplicationConfig = {
  providers: [provideAtomicClient({ app: "my-app" }), provideAtomicNotifications()],
};

How it works

400, 403, 500 and 503 raise a notify.error(…) toast; an impersonation rejected by the server (401 with errorCode: 6) gets its own explicit message. A plain 401 raises nothing — it is handled by the authentication path, not shown to the user; provideSessionExpiry() is the opt-in that tells the user their session ended. Two sources of noise are silenced on top of that: a 400 on api/v2/user-profile (the expected "not created yet" answer) and any failure on api/v1/preview, which the preview panel surfaces itself.

Because it listens to the client's event rather than wrapping HttpClient, it covers every request the client makes — including the ones that never go through Angular's HttpClient at all.

Pitfalls

What's next

On this page