updating env variables
This commit is contained in:
24
app/src/hooks/httpClient/UseHttpClient.tsx
Normal file
24
app/src/hooks/httpClient/UseHttpClient.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import axios, { AxiosInstance, CreateAxiosDefaults } from 'axios';
|
||||
|
||||
export const useHttpClient = () => {
|
||||
let config: CreateAxiosDefaults<any>;
|
||||
|
||||
if (import.meta.env.DEV) {
|
||||
config = {
|
||||
baseURL: import.meta.env.VITE_API_URL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
} else {
|
||||
config = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const httpClient: AxiosInstance = axios.create(config);
|
||||
|
||||
return httpClient;
|
||||
};
|
||||
Reference in New Issue
Block a user