Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Injectable, OnInit} from "@angular/core";
- import {Http, HTTP_PROVIDERS, URLSearchParams} from "@angular/http";
- /**
- AngularJS Service, to contain everything related to notifications.
- **/
- @Injectable()
- export class NotificationService {
- private user: Object;
- constructor(public http: Http) {
- this.user = JSON.parse(Cookies.get("authed"));
- }
- getAndDisplayNotifications() {
- }
- dispatchNotificationToUser(message: String, action: String, type: String, callback: String) {
- let body = {"owner": this.user.mail, "message": message, "action": action, "type": type, "callback": callback};
- console.log(body);
- this.http.post("example.com", JSON.stringify(body)).subscribe(
- data => console.log(JSON.parse(data._body))
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement