list suggestions
This commit is contained in:
@@ -5,6 +5,7 @@ import { of, tap, throwError } from 'rxjs';
|
||||
import {
|
||||
AddListItemRequest,
|
||||
CreateListRequest,
|
||||
CreateListWithItemSuggestionsResponse,
|
||||
ListItemSuggestionsResponse,
|
||||
UpdateListItemRequest,
|
||||
UpdateListRequest,
|
||||
@@ -59,6 +60,23 @@ export class ListsService {
|
||||
return this.http.post<UserList>(this.apiUrl, data);
|
||||
}
|
||||
|
||||
createListWithItemSuggestions(
|
||||
data: CreateListRequest,
|
||||
): Observable<CreateListWithItemSuggestionsResponse> {
|
||||
if (!this.onlineStatus.online()) {
|
||||
return throwError(
|
||||
() => new Error('Listen mit KI koennen nur online erstellt werden.'),
|
||||
);
|
||||
}
|
||||
|
||||
return this.http
|
||||
.post<CreateListWithItemSuggestionsResponse>(
|
||||
`${this.apiUrl}/with-item-suggestions`,
|
||||
data,
|
||||
)
|
||||
.pipe(tap((response) => this.upsertCachedList(response.list)));
|
||||
}
|
||||
|
||||
updateList(listId: string, data: UpdateListRequest): Observable<UserList> {
|
||||
if (!this.onlineStatus.online()) {
|
||||
const updatedList = this.updateCachedList(listId, (list) => ({
|
||||
|
||||
Reference in New Issue
Block a user