Skip to content

Commit

Permalink
update axios instance
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-torabiv committed Aug 1, 2024
1 parent 6a81856 commit 07b7dc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_BASE_URL=https://onchain.togethercrew.de/api/v1/
13 changes: 11 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -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',
},
Expand Down

0 comments on commit 07b7dc0

Please sign in to comment.