-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dotcms-ui): Fix error with autocomplete #30249
- Loading branch information
Showing
6 changed files
with
48 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
...plate-builder/components/add-style-classes-dialog/add-style-classes-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 12 additions & 5 deletions
17
...nts/template-builder/components/add-style-classes-dialog/services/json-classes.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import { Observable } from 'rxjs'; | ||
import { Observable, of } from 'rxjs'; | ||
|
||
import { HttpClient } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { inject, Injectable } from '@angular/core'; | ||
|
||
import { catchError, map } from 'rxjs/operators'; | ||
|
||
import { MOCK_STYLE_CLASSES_FILE } from '../../../utils/mocks'; | ||
|
||
export const STYLE_CLASSES_FILE_URL = '/application/templates/classes.json'; | ||
|
||
@Injectable() | ||
export class JsonClassesService { | ||
constructor(private http: HttpClient) {} | ||
readonly #http = inject(HttpClient); | ||
|
||
getClasses(): Observable<{ classes: string[] }> { | ||
return this.http.get<{ classes: string[] }>(STYLE_CLASSES_FILE_URL); | ||
getClasses(): Observable<string[]> { | ||
return this.#http.get<{ classes: string[] }>(STYLE_CLASSES_FILE_URL).pipe( | ||
map((res) => res.classes), | ||
catchError(() => of(MOCK_STYLE_CLASSES_FILE.classes)) | ||
); | ||
} | ||
} |