From d865af072b7ab6bf69d9308b1ccabbf21a7149ab Mon Sep 17 00:00:00 2001 From: Simone Taeggi Date: Wed, 11 Jan 2023 13:41:29 +0100 Subject: [PATCH] temporary solution --- .../core/helper-plugin/lib/src/utils/fetchClient/index.js | 4 ++-- .../helper-plugin/lib/src/utils/getFetchClient/index.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/core/helper-plugin/lib/src/utils/fetchClient/index.js b/packages/core/helper-plugin/lib/src/utils/fetchClient/index.js index 515bec88a7..522d395cd3 100644 --- a/packages/core/helper-plugin/lib/src/utils/fetchClient/index.js +++ b/packages/core/helper-plugin/lib/src/utils/fetchClient/index.js @@ -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; diff --git a/packages/core/helper-plugin/lib/src/utils/getFetchClient/index.js b/packages/core/helper-plugin/lib/src/utils/getFetchClient/index.js index 2ad3cb6475..00d17e5381 100644 --- a/packages/core/helper-plugin/lib/src/utils/getFetchClient/index.js +++ b/packages/core/helper-plugin/lib/src/utils/getFetchClient/index.js @@ -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;