40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpWrapperService } from 'app/http-wrapper.service';
|
|
|
|
@Injectable()
|
|
export class SaisonService {
|
|
// 0: Not hide password; 1 hide password;
|
|
private identificationVersion: number = 1;
|
|
|
|
constructor(private http: HttpWrapperService) {
|
|
console.log("Start SaisonService");
|
|
}
|
|
|
|
get(_id:number):any {
|
|
console.log("Get All data from types");
|
|
const httpOption = { 'Content-Type': 'application/json' };
|
|
let url = "saison/" + _id;
|
|
console.log("call GET " + url);
|
|
|
|
return new Promise((resolve, reject) => {
|
|
this.http.get(url, httpOption, {})
|
|
.then(function(response: any) {
|
|
if (response.status == 200) {
|
|
resolve(response.data);
|
|
console.log("get data from type : " + response.data);
|
|
return;
|
|
}
|
|
reject("An error occured");
|
|
}, function(response: any) {
|
|
if (typeof response.data === 'undefined') {
|
|
reject("return ERROR undefined");
|
|
} else {
|
|
reject("return ERROR " + JSON.stringify(response.data, null, 2));
|
|
}
|
|
});
|
|
});
|
|
|
|
};
|
|
}
|
|
|