refactor(web): utilize REACT_APP_BACKEND_URL for GQL and REST API URLs

This commit is contained in:
Ali BARIN
2024-03-01 12:37:17 +00:00
parent 917de46c45
commit 73bd90c555
5 changed files with 34 additions and 6 deletions

View File

@@ -1,7 +1,9 @@
import { ApolloClient } from '@apollo/client';
import cache from './cache';
import createLink from './link';
import appConfig from 'config/app';
const client = new ApolloClient({
cache,
link: createLink({ uri: appConfig.graphqlUrl }),
@@ -11,10 +13,19 @@ const client = new ApolloClient({
},
},
});
export function mutateAndGetClient(options) {
const { onError, token } = options;
const link = createLink({ uri: appConfig.graphqlUrl, token, onError });
const link = createLink({
uri: appConfig.graphqlUrl,
token,
onError,
});
client.setLink(link);
return client;
}
export default client;