49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
/** @file
|
|
* @author Edouard DUPIN
|
|
* @copyright 2018, Edouard DUPIN, all right reserved
|
|
* @license PROPRIETARY (see license file)
|
|
*/
|
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
import { ActivatedRoute } from '@angular/router';
|
|
import { fadeInAnimation } from '../../_animations/index';
|
|
|
|
import { TypeService } from '../../service/type';
|
|
import { ArianeService } from '../../service/ariane';
|
|
|
|
@Component({
|
|
selector: 'app-home',
|
|
templateUrl: './home.html',
|
|
styleUrls: [ './home.less' ],
|
|
animations: [ fadeInAnimation ],
|
|
host: { '[@fadeInAnimation]': '' }
|
|
})
|
|
export class HomeScene implements OnInit {
|
|
dataList = [];
|
|
error = '';
|
|
constructor(private route: ActivatedRoute,
|
|
private typeService: TypeService,
|
|
private arianeService: ArianeService) {
|
|
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.arianeService.updateManual(this.route.snapshot.paramMap);
|
|
let self = this;
|
|
this.typeService.getData()
|
|
.then((response) => {
|
|
self.error = '';
|
|
self.dataList = response;
|
|
console.log(`Get response: ${ JSON.stringify(response, null, 2)}`);
|
|
}).catch((response) => {
|
|
self.error = 'Wrong e-mail/login or password';
|
|
console.log(`[E] ${ self.constructor.name }: Does not get a correct response from the server ...`);
|
|
self.dataList = [];
|
|
});
|
|
this.arianeService.reset();
|
|
}
|
|
onSelectType(_event: any, _idSelected: number):void {
|
|
this.arianeService.navigateType(_idSelected, _event.which === 2);
|
|
}
|
|
}
|