2018-08-27 21:31:27 +00:00
|
|
|
import fetch from 'cross-fetch';
|
|
|
|
|
2018-08-29 01:52:21 +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"
|
|
|
|
return fetch(domain + path);
|
|
|
|
}
|