File: /var/dev/nowruzgan/admin/src/app/services/role.service.ts
import { Injectable } from '@angular/core';
import { GenericService } from './generic.service';
import { Role } from '../data.types';
import { environment } from '../../environments/environment';
@Injectable()
export class RoleService extends GenericService {
async list(): Promise<Role[]> {
let response = await this.http
.get(`${environment.apiBase}/role`, this.headers)
.toPromise()
.catch(error => this.handleError(error));
if(!response) return [];
return (response as any[]).map(record => new Role(record));
}
}