Open History to see the last commit
1import { HttpClient } from '@angular/common/http'
2import { ChangeDetectionStrategy, Component, inject } from '@angular/core'
3import { injectQuery } from '@tanstack/angular-query'
4import { lastValueFrom } from 'rxjs'
5β
6interface Response {
7 name: string
8 description: string
9 subscribers_count: number
10 stargazers_count: number
11 forks_count: number
12}
13β
14@Component({
15 changeDetection: ChangeDetectionStrategy.OnPush,
16 selector: 'dynamic-devtools-example',
17 templateUrl: './dynamic-devtools-example.component.html',
18})
19export class DynamicDevtoolsExampleComponent {
20 readonly #http = inject(HttpClient)
21β
22 readonly query = injectQuery(() => ({
23 queryKey: ['repoData'],
24 queryFn: () =>
25 lastValueFrom(
26 this.#http.get<Response>('https://api.github.com/repos/tanstack/query'),
27 ),
28 }))
29}