diff --git a/.env b/.env new file mode 100644 index 0000000..2092a11 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_API_BASE_URL=https://onchain.togethercrew.de/api/v1/ \ No newline at end of file diff --git a/src/api/index.ts b/src/api/index.ts index 89bd8c0..15ec0e3 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,7 +1,16 @@ +// src/api/index.ts import axios from 'axios'; -export const client = axios.create({ - baseURL: '', +const baseURL = import.meta.env.VITE_API_BASE_URL; + +if (!baseURL) { + throw new Error( + 'VITE_API_BASE_URL is not defined in your environment variables' + ); +} + +export const api = axios.create({ + baseURL, headers: { 'Content-Type': 'application/json', },