forked from geolba/tethys.frontend
- add sitelink-view-component with portal REST requests
This commit is contained in:
parent
2c0c67cd64
commit
132edd4214
10 changed files with 216 additions and 15 deletions
|
@ -2,11 +2,12 @@
|
|||
import api from "../api/api";
|
||||
import { Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
import { Dataset, Suggestion } from "@/models/dataset";
|
||||
import { Dataset, DbDataset, Suggestion } from "@/models/dataset";
|
||||
import { SolrResponse } from "@/models/headers";
|
||||
import { ActiveFilterCategories } from "@/models/solr";
|
||||
import { VUE_APP_PORTAL } from "@/constants";
|
||||
|
||||
export class DatasetService {
|
||||
class DatasetService {
|
||||
// for the autocomplete search
|
||||
public searchTerm(term: string, solrCore: string, solrHost: string): Observable<Dataset[]> {
|
||||
// solr endpoint
|
||||
|
@ -138,4 +139,27 @@ export class DatasetService {
|
|||
|
||||
return stations;
|
||||
}
|
||||
|
||||
getYears(): Observable<string[]> {
|
||||
// const heroes = of(HEROES);
|
||||
const host = "https:" + VUE_APP_PORTAL;
|
||||
const path = "/api/years";
|
||||
const base = host + path;
|
||||
|
||||
const years = api.get<string[]>(base);
|
||||
// this.messageService.add('HeroService: fetched heroes');
|
||||
return years;
|
||||
}
|
||||
|
||||
getDocuments(year: string): Observable<Array<DbDataset>> {
|
||||
const host = "https:" + VUE_APP_PORTAL;
|
||||
const path = "/api/sitelinks/" + year;
|
||||
const base = host + path;
|
||||
|
||||
const documents = api.get<Array<DbDataset>>(base);
|
||||
// this.messageService.add('HeroService: fetched heroes');
|
||||
return documents;
|
||||
}
|
||||
}
|
||||
|
||||
export default new DatasetService();
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue