diff options
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list.service.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list.service.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list.service.ts b/Timeline/ClientApp/src/app/todo-list.service.ts index e92a11c9..b1bc5ff3 100644 --- a/Timeline/ClientApp/src/app/todo-list.service.ts +++ b/Timeline/ClientApp/src/app/todo-list.service.ts @@ -17,6 +17,11 @@ interface WorkItemResult { fields: { [name: string]: any }; } +export interface WorkItem { + id: number; + title: string; +} + @Injectable({ providedIn: 'root' }) @@ -37,13 +42,13 @@ export class TodoListService { }); } - getWorkItemList(): Observable<string[]> { + getWorkItemList(): Observable<WorkItem[]> { return this.client.post<WiqlResult>(`https://dev.azure.com/${this.organization}/${this.project}/_apis/wit/wiql?api-version=5.0`, { query: 'SELECT [System.Id] FROM workitems WHERE [System.TeamProject] = @project' }, { headers: this.headers }).pipe( switchMap(result => result.workItems), concatMap(result => this.client.get<WorkItemResult>(result.url, {headers: this.headers})), - map(result => <string>(result.fields[this.fieldId])), + map(result => <WorkItem>{ id: result.id, title: result.fields[this.fieldId] }), toArray() ); } |