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.
20 lines
465 B
20 lines
465 B
2 years ago
|
import axios from 'axios'
|
||
|
|
||
|
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;
|
||
|
}
|