React frontend for Agorata
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
526 B

import axios from 'axios'
declare var process : {
env: {
NODE_ENV: string
}
}
export class Api {
public readonly api_url: string;
constructor() {
if (process.env.NODE_ENV === 'development') {
this.api_url = 'http://localhost:5000/';
} else {
this.api_url = 'https://api.agorata.io/';
}
}
}
export const config = new Api();
export async function call_api(url: string) {
return (await axios.get(config.api_url + url, {withCredentials: true})).data;
}