2018-08-27 21:31:27 +00:00
|
|
|
import fetch from 'cross-fetch';
|
|
|
|
|
2018-09-01 13:32:04 +00:00
|
|
|
// const API_ROOT = "https://fediverse.space/api/v1/"
|
|
|
|
const API_ROOT = "http://localhost:8000/api/v1/"
|
2018-08-27 21:31:27 +00:00
|
|
|
|
|
|
|
export const getFromApi = (path: string): Promise<any> => {
|
|
|
|
const domain = API_ROOT.endsWith("/") ? API_ROOT : API_ROOT + "/";
|
|
|
|
path = path.endsWith("/") ? path : path + "/";
|
|
|
|
path += "?format=json"
|
2018-09-01 13:32:04 +00:00
|
|
|
return fetch(domain + path).then(response => response.json());
|
2018-08-27 21:31:27 +00:00
|
|
|
}
|