16 lines
610 B
TypeScript
16 lines
610 B
TypeScript
import { computed, inject, Injectable, type Signal } from '@angular/core';
|
|
import { LocaleService } from '../i18n/locale.service';
|
|
import { type RouteId } from '../routing/route-ids';
|
|
import { type PageCopy } from './content.contracts';
|
|
import { SITE_CONTENT } from './content.token';
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
export class ContentService {
|
|
private readonly localeService = inject(LocaleService);
|
|
private readonly content = inject(SITE_CONTENT);
|
|
|
|
page(routeId: RouteId): Signal<PageCopy | undefined> {
|
|
return computed(() => this.content[this.localeService.locale()].pages[routeId]);
|
|
}
|
|
}
|