Created
March 2, 2017 14:28
-
-
Save brunokrebs/7c566da11998d69bce578bc55174aa58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { AuthHttp } from 'angular2-jwt'; | |
@Injectable() | |
export class TaskListService { | |
private static TASKS_ENDPOINT = | |
'https://wt-e1870b8a73b27cdee73c468b8c8e3bc4-0.run.webtask.io/tasks'; | |
constructor(private authHttp: AuthHttp) { } | |
loadTasks$(): Observable<any> { | |
return this.authHttp.get(TaskListService.TASKS_ENDPOINT); | |
} | |
addTask$(task) : Observable<any> { | |
return this.authHttp.post(TaskListService.TASKS_ENDPOINT, | |
{ description: task }); | |
} | |
deleteTask$(task): Observable<any> { | |
return this.authHttp.delete(TaskListService.TASKS_ENDPOINT + | |
'?id=' + task._id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment