1
1
// tslint:disable
2
2
3
3
import { CustomHttpClient } from "../../custom-http-client";
4
+ import { Value } from "../models/value";
4
5
import { Injectable } from "@angular/core";
5
6
import { Observable } from "rxjs";
6
7
import { Subject } from "rxjs";
7
8
8
9
@Injectable({
9
10
providedIn: "root"
10
11
})
11
- export class ValuesService {
12
+ export class CustomValuesService {
12
13
private readonly http: CustomHttpClient;
13
14
public serviceUrl: string = "";
14
15
@@ -18,10 +19,10 @@ export class ValuesService {
18
19
19
20
public get(httpOptions?: {}): Observable<string[]> {
20
21
let subject = new Subject<string[]>();
21
- this.http.get(this.serviceUrl + "", httpOptions).subscribe(result => {
22
+ this.http.get(this.serviceUrl + "/Values ", httpOptions).subscribe(result => {
22
23
const list: string[] = [];
23
24
for (const entry of <[]>result) {
24
- list.push(new string( entry) );
25
+ list.push(< string> entry);
25
26
26
27
}
27
28
subject.next(list);
@@ -30,28 +31,28 @@ export class ValuesService {
30
31
return subject;
31
32
}
32
33
33
- public get2(id: number, httpOptions?: {}): Observable<string > {
34
- let subject = new Subject<string >();
35
- this.http.get(this.serviceUrl + "?id=" + id, httpOptions).subscribe(result => {
36
- const model = new string (result);
34
+ public get2(id: number, httpOptions?: {}): Observable<Value > {
35
+ let subject = new Subject<Value >();
36
+ this.http.get(this.serviceUrl + "/Values ?id=" + id, httpOptions).subscribe(result => {
37
+ const model = new Value (result);
37
38
subject.next(model);
38
39
subject.complete();
39
40
}, error => subject.error(error));
40
41
return subject;
41
42
}
42
43
43
- public post(value: string , httpOptions?: {}): Observable<void> {
44
+ public post(value: Value , httpOptions?: {}): Observable<void> {
44
45
let subject = new Subject<void>();
45
- this.http.post(this.serviceUrl + "", value, httpOptions).subscribe(() => {
46
+ this.http.post(this.serviceUrl + "/Values ", value, httpOptions).subscribe(() => {
46
47
subject.next();
47
48
subject.complete();
48
49
}, error => subject.error(error));
49
50
return subject;
50
51
}
51
52
52
- public put(id: number, value: string , httpOptions?: {}): Observable<void> {
53
+ public put(id: number, value: Value , httpOptions?: {}): Observable<void> {
53
54
let subject = new Subject<void>();
54
- this.http.put(this.serviceUrl + "?id=" + id, value, httpOptions).subscribe(() => {
55
+ this.http.put(this.serviceUrl + "/Values ?id=" + id, value, httpOptions).subscribe(() => {
55
56
subject.next();
56
57
subject.complete();
57
58
}, error => subject.error(error));
@@ -60,7 +61,7 @@ export class ValuesService {
60
61
61
62
public delete(id: number, httpOptions?: {}): Observable<void> {
62
63
let subject = new Subject<void>();
63
- this.http.delete(this.serviceUrl + "?id=" + id, httpOptions).subscribe(() => {
64
+ this.http.delete(this.serviceUrl + "/Values ?id=" + id, httpOptions).subscribe(() => {
64
65
subject.next();
65
66
subject.complete();
66
67
}, error => subject.error(error));
0 commit comments