diff --git a/src/app/core/providers/runtime-provider-strategy.service.ts b/src/app/core/providers/runtime-provider-strategy.service.ts index 4660f5e..8c6d907 100644 --- a/src/app/core/providers/runtime-provider-strategy.service.ts +++ b/src/app/core/providers/runtime-provider-strategy.service.ts @@ -48,6 +48,15 @@ export class RuntimeProviderStrategyService { return 'mock'; } + // Same rationale as getBootstrapProviderMode(): the admin Categories CRUD + // gateway has a real local-mock implementation (AdminCategoriesLocalGateway) + // built specifically so create/edit/delete/reorder can be exercised without + // a backend. Local dev has no reachable backoffice API, so fall back to it + // there while production keeps hitting the real API unconditionally. + if ((environment as any).useMockBootstrapOnLocal === true && this.isLocalhost()) { + return 'mock'; + } + return 'api'; } } diff --git a/src/app/features/admin/categories/components/admin-categories-list.component.html b/src/app/features/admin/categories/components/admin-categories-list.component.html index d30783d..082b62b 100644 --- a/src/app/features/admin/categories/components/admin-categories-list.component.html +++ b/src/app/features/admin/categories/components/admin-categories-list.component.html @@ -125,7 +125,7 @@ @if (row.category.deletedAt) { {{ 'adminCategories.restore' | translate }} } @else { - {{ 'adminProducts.edit' | translate }} + {{ 'adminCategories.edit' | translate }} {{ 'adminProducts.delete' | translate }} } @@ -164,7 +164,7 @@ @if (category.deletedAt) { {{ 'adminCategories.restore' | translate }} } @else { - {{ 'adminProducts.edit' | translate }} + {{ 'adminCategories.edit' | translate }} {{ 'adminProducts.delete' | translate }} } diff --git a/src/app/features/admin/categories/services/admin-categories-gateway.token.ts b/src/app/features/admin/categories/services/admin-categories-gateway.token.ts index 74446f2..ad073ab 100644 --- a/src/app/features/admin/categories/services/admin-categories-gateway.token.ts +++ b/src/app/features/admin/categories/services/admin-categories-gateway.token.ts @@ -8,7 +8,7 @@ export const ADMIN_CATEGORIES_GATEWAY = new InjectionToken { const strategy = inject(RuntimeProviderStrategyService); - const mode = strategy.getBackofficeProviderMode(); + const mode = strategy.getCategoryProviderMode(); return mode === 'mock' ? inject(AdminCategoriesLocalGateway) : inject(AdminCategoriesApiGateway); } });