Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

projects.service.ts

22 lines472 Bytes

1import { HttpClient } from '@angular/common/http'
2import { Injectable, inject } from '@angular/core'
3​
4interface Project {
5 id: number
6 name: string
7}
8​
9interface ProjectResponse {
10 data: Array<Project>
11 nextId: number | undefined
12 previousId: number | undefined
14​
15@Injectable({
16 providedIn: 'root',
17})
18export class ProjectsService {
19 #http = inject(HttpClient)
20 getProjects = (page: number) =>
21 this.#http.get<ProjectResponse>(`/api/projects?cursor=${page}`)