Skip to content

Commit 129b3b8

Browse files
committed
chore(playground): 🤖 merge changes from next into branch
1 parent dbaddd6 commit 129b3b8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/app/basic-page/todos.service.ts

Whitespace-only changes.

src/app/services/todos.service.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HttpClient } from '@angular/common/http';
22
import { Injectable, inject } from '@angular/core';
3-
import { injectMutation, injectQuery, toPromise } from '@ngneat/query';
3+
import { injectMutation, injectQuery, queryOptions, toPromise } from '@ngneat/query';
44

55
interface Todo {
66
id: number;
@@ -13,6 +13,17 @@ export class TodosService {
1313
private useMutation = injectMutation();
1414
private http = inject(HttpClient);
1515

16+
todosQuery = queryOptions({
17+
queryKey: ['todos'] as const,
18+
queryFn: ({ signal }) => {
19+
const source = this.http.get<Todo[]>(
20+
'https://jsonplaceholder.typicode.com/todos'
21+
);
22+
23+
return toPromise({ source, signal });
24+
},
25+
});
26+
1627
getTodos() {
1728
return this.query({
1829
queryKey: ['todos'] as const,

0 commit comments

Comments
 (0)