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
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
Serve a second backend
Give a route or component subtree its own Sinequa client plus a self-contained copy of the library's stores and services, so two backends never leak into each other.
Warn before the session expires
Tell the user shortly before their session expires, and when it already has, whatever way they signed in.