mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-22 07:53:34 +01:00
28 lines
582 B
JavaScript
28 lines
582 B
JavaScript
import axios from "axios";
|
|
|
|
const apiClient = axios.create({
|
|
baseURL: process.env.NEXT_PUBLIC_GRAFNODE_SERVER_API
|
|
});
|
|
|
|
apiClient.interceptors.request.use((config) => {
|
|
const headers = {
|
|
'Content-Type': 'application/json'
|
|
};
|
|
|
|
return ({
|
|
...config,
|
|
headers: headers
|
|
});
|
|
}, error => Promise.reject(error));
|
|
|
|
apiClient.interceptors.response.use((response) =>
|
|
response,
|
|
async (error) => {
|
|
return Promise.reject(error.response ? error.response.data : error);
|
|
}
|
|
);
|
|
|
|
const { get, post, put, delete: destroy } = apiClient;
|
|
|
|
export { get, post, put, destroy };
|