import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { Alias } from 'app/shared/models/alias.model' ; import { Icon } from './models/icon.model' ; import { FontVersion } from './models/fontVersion.model' ; @ Injectable ( ) export class AliasService { constructor ( private http ) { } param icon param alias param fontVersion async assignAlias ( icon , alias , fontVersion ) { const body = { icon : { id : icon . id } , alias : { name : alias . name } , fontVersion } ; const res = await this . http . post < Icon > ( '/api/admin/icon/alias' , body ) . toPromise ( ) ; return new Icon ( ) . from ( res ) ; } param icon param alias async deleteAlias ( icon , alias ) { const res = await this . http . delete < Icon > ( `/api/admin/icon/${ icon . id }/alias/${ alias . id }` ) . toPromise ( ) ; return new Icon ( ) . from ( res ) ; } }