@themodcraft/nextramice-angular
v0.1.0
Published
Angular signal store for Nextramice authentication.
Readme
@themodcraft/nextramice-angular
Angular signals and dependency-injection bindings for the Nextramice BFF API.
Install
npm install @themodcraft/nextramice-angular @themodcraft/nextramice-coreConfigure
import { ApplicationConfig } from "@angular/core";
import { provideNextramice } from "@themodcraft/nextramice-angular";
export const appConfig: ApplicationConfig = {
providers: [provideNextramice({ baseUrl: "/nextramice" })],
};Read authentication state
import { Component, inject } from "@angular/core";
import { NextramiceStore } from "@themodcraft/nextramice-angular";
@Component({
selector: "app-user-menu",
template: `
@if (auth.user(); as user) {
<span>{{ user.displayName ?? user.username }}</span>
<button (click)="auth.logout()">Log out</button>
}
`,
})
export class UserMenu {
readonly auth = inject(NextramiceStore);
}Call auth.loadSession() during application initialization. The store also
provides authenticated, authorities, claims, loading, error, login,
register, and hasAuthority.
Override NEXTRAMICE_BACKEND to use a custom NextramiceBackendService.
For browser-managed OAuth, use @themodcraft/nextramice-angular-oidc instead of this BFF
store.
