refine-jsonapi
Version:
Data provider for refine with JSON:API specification. refine is a React-based framework for building internal tools, rapidly. JSON:API is a specification for building apis in JSON.
22 lines (17 loc) • 456 B
text/typescript
import { HttpError } from "@refinedev/core";
import axios from "axios";
const axiosInstance = axios.create();
axiosInstance.interceptors.response.use(
(response) => {
return response;
},
(error) => {
const customError: HttpError = {
...error,
message: error.response?.data?.message,
statusCode: error.response?.status,
};
return Promise.reject(customError);
}
);
export { axiosInstance };