1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/faces/faces.service.ts
2019-02-14 18:25:55 -05:00

21 lines
587 B
TypeScript

import {Injectable} from '@angular/core';
import {NetworkService} from '../model/network/network.service';
import {BehaviorSubject} from 'rxjs';
import {PersonDTO} from '../../../common/entities/PersonDTO';
@Injectable()
export class FacesService {
public persons: BehaviorSubject<PersonDTO[]>;
constructor(private networkService: NetworkService) {
this.persons = new BehaviorSubject<PersonDTO[]>(null);
}
public async getPersons() {
this.persons.next((await this.networkService.getJson<PersonDTO[]>('/person')).sort((a, b) => a.name.localeCompare(b.name)));
}
}