blob: fa1a3245066483d891b4d2881561e658ec1cea6a [file] [log] [blame]
import { ListDashboardResponse } from './gen/pb/api/v1/data.js';
export interface APIClient {
getDashboards(): Array<String>;
}
export class APIClientImpl implements APIClient {
host: String = 'http://localhost:8080';
public getDashboards(): Array<String> {
const dashboards: Array<String> = [];
fetch(`${this.host}/api/v1/dashboards`).then(async response => {
const resp = ListDashboardResponse.fromJson(await response.json());
resp.dashboards.forEach(db => {
dashboards.push(db.name);
});
});
return dashboards;
}
}