fixing and styleing

This commit is contained in:
sdarbinyan
2026-02-20 01:25:29 +04:00
parent cb1349a5fd
commit 070e254a5c
17 changed files with 176 additions and 61 deletions

View File

@@ -103,9 +103,12 @@ export class ApiService {
);
}
createSubcategory(categoryId: string, data: Partial<Subcategory>): Observable<Subcategory> {
if (environment.useMockData) return this.mockService.createSubcategory(categoryId, data);
return this.http.post<Subcategory>(`${this.API_BASE}/categories/${categoryId}/subcategories`, data).pipe(
createSubcategory(parentId: string, parentType: 'category' | 'subcategory', data: Partial<Subcategory>): Observable<Subcategory> {
if (environment.useMockData) return this.mockService.createSubcategory(parentId, data);
const endpoint = parentType === 'category'
? `${this.API_BASE}/categories/${parentId}/subcategories`
: `${this.API_BASE}/subcategories/${parentId}/subcategories`;
return this.http.post<Subcategory>(endpoint, data).pipe(
catchError(this.handleError)
);
}