diff options
author | crupest <crupest@outlook.com> | 2019-03-06 21:29:36 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-06 21:29:36 +0800 |
commit | 63735a8267d44892a64da5b599b7c2e20f373464 (patch) | |
tree | 7f43f0beb8c465e06e0d1c4d18cadfb77c39bc78 /Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts | |
parent | 8ec742c4a00c1732d6aa58a1cb8b628428d23c4a (diff) | |
download | timeline-63735a8267d44892a64da5b599b7c2e20f373464.tar.gz timeline-63735a8267d44892a64da5b599b7c2e20f373464.tar.bz2 timeline-63735a8267d44892a64da5b599b7c2e20f373464.zip |
Reorganize file structure.
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts deleted file mode 100644 index ffcbbc6f..00000000 --- a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; -import { Observable, from } from 'rxjs'; -import { switchMap, map, filter } from 'rxjs/operators'; - -export interface IssueResponseItem { - number: number; - title: string; - state: string; - html_url: string; - pull_request?: any; -} - -export type IssueResponse = IssueResponseItem[]; - -export interface TodoItem { - number: number; - title: string; - isClosed: boolean; - detailUrl: string; -} - -@Injectable({ - providedIn: 'root' -}) -export class TodoListService { - - readonly baseUrl = 'https://api.github.com/repos/crupest/Timeline'; - - constructor(private client: HttpClient) { } - - getWorkItemList(): Observable<TodoItem> { - return this.client.get<IssueResponse>(`${this.baseUrl}/issues`, { - params: { - state: 'all' - } - }).pipe( - switchMap(result => from(result)), - filter(result => result.pull_request === undefined), // filter out pull requests. - map(result => <TodoItem>{ - number: result.number, - title: result.title, - isClosed: result.state === 'closed', - detailUrl: result.html_url - }) - ); - } -} |