Skip to content

Commit

Permalink
closes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Apr 30, 2024
1 parent 52618f8 commit ac799eb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion interfaces/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface IProductDefinition {
export interface IProduct extends IProductDefinition {
filters: IProductFilter[];
subproducts: IProductDefinition[];
cardTemplate: string;
cardTemplate: Record<string, string>;
external: {
rules: string;
faq: Record<string, string>;
Expand Down
11 changes: 8 additions & 3 deletions src/app/meta.service.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';

import type { IProduct, IProductFilter } from '../../interfaces';
import { environment } from '../environments/environment';
import { LocaleService } from './locale.service';

@Injectable({
providedIn: 'root',
})
export class MetaService {
private localeService = inject(LocaleService);

private allProducts: IProduct[] = [];
private productNamesByProductId: Record<string, string> = {};
private templatesByProductId: Record<string, string> = {};
private templatesByProductId: Record<string, Record<string, string>> = {};
private rulesByProductId: Record<string, string> = {};
private filtersByProductId: Record<string, IProductFilter[]> = {};
private faqByProductId: Record<string, Record<string, string>> = {};
Expand Down Expand Up @@ -42,7 +45,9 @@ export class MetaService {
}

public getTemplateByProductId(productId: string): string {
return this.templatesByProductId[productId];
return this.templatesByProductId[productId][
this.localeService.currentLocale()
];
}

public getRulesByProductId(productId: string): string {
Expand Down

0 comments on commit ac799eb

Please sign in to comment.