Open History to see the last commit
1import { HttpClient } from '@angular/common/http'
2import { Injectable, inject } from '@angular/core'
3β
4@Injectable({
5 providedIn: 'root',
6})
7export class TasksAPI {
8 readonly #http = inject(HttpClient)
9β
10 getTasks = () => this.#http.get<Array<string>>('/api/tasks')
11β
12 createTask = ({
13 task,
14 failMutation = false,
15 }: {
16 task: string
17 failMutation: boolean
18 }) => this.#http.post(`/api/tasks${failMutation ? '-wrong-url' : ''}`, task)
19}