mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-28 10:44:23 +01:00
fix: enable cors on login/logout api
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
import { ApolloClient, HttpLink, InMemoryCache, from, Reference, FieldPolicy } from "@apollo/client";
|
||||
import { onError } from "@apollo/client/link/error";
|
||||
import { RetryLink } from "@apollo/client/link/retry";
|
||||
import CONSTS from "./consts";
|
||||
import { CONSTS } from "src/utils";
|
||||
|
||||
let apiClientUri = CONSTS.apiEndpoint + '/graphql';
|
||||
|
||||
|
||||
const httpLink = new HttpLink({
|
||||
uri: apiClientUri,
|
||||
credentials: process.env.REACT_APP_API_END_POINT?.includes('localhost') ? 'include' : "same-origin"
|
||||
credentials: "include"
|
||||
});
|
||||
|
||||
const errorLink = onError(({ graphQLErrors, networkError, response }) => {
|
||||
console.log('AHIHIHA');
|
||||
|
||||
if (graphQLErrors)
|
||||
graphQLErrors.forEach(({ message, locations, path }) =>
|
||||
console.log(
|
||||
|
||||
5
src/utils/consts/consts.ts
Normal file
5
src/utils/consts/consts.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
const CONSTS = {
|
||||
apiEndpoint: 'http://localhost:8888/.netlify/functions'
|
||||
}
|
||||
|
||||
export default CONSTS;
|
||||
@@ -1,5 +0,0 @@
|
||||
const CONSTS = {
|
||||
apiEndpoint: process.env.REACT_APP_API_END_POINT ?? '/.netlify/functions'
|
||||
}
|
||||
|
||||
export default CONSTS;
|
||||
1
src/utils/index.ts
Normal file
1
src/utils/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as CONSTS } from './consts/consts'
|
||||
Reference in New Issue
Block a user