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