assets/angular/shared/email-service.ts
User related service...
Properties |
Methods |
constructor(http: Http, configService: ConfigService)
|
||||||||||||
Defined in assets/angular/shared/email-service.ts:36
|
||||||||||||
Parameters :
|
sendNotification | ||||||||||||||||||||||||
sendNotification(to: string, template: string, data: any, subject: string, from: string)
|
||||||||||||||||||||||||
Defined in assets/angular/shared/email-service.ts:42
|
||||||||||||||||||||||||
Parameters :
Returns :
Promise<any>
|
Protected baseUrl |
baseUrl:
|
Type : any
|
Defined in assets/angular/shared/email-service.ts:34
|
Protected config |
config:
|
Type : any
|
Defined in assets/angular/shared/email-service.ts:35
|
Protected headers |
headers:
|
Type : any
|
Defined in assets/angular/shared/email-service.ts:36
|
import { Injectable, Inject} from '@angular/core';
import { Http, Response, RequestOptions, Headers } from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import { BaseService } from '../shared/base-service'
import { ConfigService } from '../shared/config-service';
/**
* User related service...
*
* @author <a target='_' href='https://github.com/thomcuddihy'>Thom Cuddihy</a>
*
*/
@Injectable()
export class EmailNotificationService extends BaseService {
protected baseUrl: any;
protected config: any;
protected headers: any;
constructor (@Inject(Http) http: Http, @Inject(ConfigService) protected configService: ConfigService) {
super(http, configService);
}
sendNotification(to: string, template: string, data: any = {}, subject: string = null, from: string = null): Promise<any> {
var payload = {to: to, template: template, data: data};
if (subject) {
payload['subject'] = subject;
}
if (from) {
payload['from'] = from;
}
return this.http.post(`${this.brandingAndPortalUrl}/api/sendNotification`, payload, this.getOptionsClient())
.toPromise()
.then(this.extractData);
}
}