temporary solution

This commit is contained in:
Simone Taeggi 2023-01-11 13:41:29 +01:00
parent 3fdd100107
commit d865af072b
2 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import axios from 'axios';
import auth from '../../utils/auth';
import auth from '../auth';
export const reqInterceptor = async (config) => {
config.headers = {
@ -44,4 +44,4 @@ export const fetchClient = ({ baseURL }) => {
return instance;
};
export default fetchClient({ baseURL: process.env.STRAPI_ADMIN_BACKEND_URL });
export default fetchClient;

View File

@ -1,12 +1,13 @@
import instance from '../fetchClient';
import fetchClient from '../fetchClient';
function getFetchClient(defaultOptions = {}) {
const getFetchClient = (defaultOptions = {}) => {
const instance = fetchClient({ baseURL: window.strapi.backendURL });
return {
get: (url, config) => instance.get(url, { ...defaultOptions, ...config }),
put: (url, data, config) => instance.put(url, data, { ...defaultOptions, ...config }),
post: (url, data, config) => instance.post(url, data, { ...defaultOptions, ...config }),
del: (url, config) => instance.delete(url, { ...defaultOptions, ...config }),
};
}
};
export default getFetchClient;