-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscore.ts
More file actions
33 lines (25 loc) · 759 Bytes
/
score.ts
File metadata and controls
33 lines (25 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { ICore } from '../interfaces/icore';
@Injectable({
providedIn: 'root'
})
export class SCore {
private readonly http = inject(HttpClient);
private cpuUrl = 'http://localhost:5294';
getAll() {
return this.http.get<ICore[]>(`${this.cpuUrl}/all`);
}
get(cpuId: number) {
return this.http.get<ICore>(`${this.cpuUrl}/all/${cpuId}`)
}
create(core: ICore) {
return this.http.post(`${this.cpuUrl}/new`, {core});
}
update(update: ICore) {
return this.http.patch(`${this.cpuUrl}/update/${update.id}`, {update});
}
delete(cpuId: number) {
return this.http.delete(`${this.cpuUrl}/delete/${cpuId}`);
}
}