This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To discover the available historic ranges.
- Loading branch information
1 parent
18b28b9
commit 9dcaa51
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface HistoricRange { | ||
start_year: string; | ||
end_year: string; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs/Rx'; | ||
|
||
import { HistoricRange } from '../models/historic-range.model'; | ||
import { ApiHttp } from '../auth/api-http.service'; | ||
import { apiHost } from '../constants'; | ||
|
||
/* | ||
* Historic Range Service | ||
* Returns available historic ranges from API | ||
*/ | ||
@Injectable() | ||
export class HistoricRangeService { | ||
|
||
constructor(private apiHttp: ApiHttp) {} | ||
|
||
public list(): Observable<HistoricRange[]> { | ||
const url = apiHost + '/api/historic-range/'; | ||
return this.apiHttp.get(url).map(resp => resp.json() || [] as HistoricRange[]); | ||
} | ||
} |