This is really what you should follow : <https://w...
# prisma-whats-new
v
d
I have upgrade the latest version of apollo-client and react-apollo.
Now, i am getting error "405 Method Not Allowed"
this is my client code
Copy code
import { ApolloClient } from 'apollo-client';
import { createHttpLink } from 'apollo-link-http';
import { setContext } from 'apollo-link-context';
import { InMemoryCache } from 'apollo-cache-inmemory';

const httpLink = createHttpLink({
  uri: '<http://graphql-api.XXXX.staging.domandtom.com/>'
});

const authLink = setContext((_, { headers }) => {
  // get the authentication token from local storage if it exists
  const token = localStorage.getItem('token');
  // return the headers to the context so httpLink can read them
  return {
    headers: {
      ...headers,
      authorization: token ? `Bearer ${token}` : ""
    }
  }
});


export const apolloClient = new ApolloClient({
  link: authLink.concat(httpLink),
  cache: new InMemoryCache()
});
v
what’s your query ?
d
Copy code
mutation ($email: String!, $password: String!) {
        signIn(email: $email, password: $password) {
          id
          access_token
          user_id
          employee{
            first_name
            last_name
          }
          dependent{
            first_name
            last_name
          }
        }
      }
v
you use express server side ?
d
i have already developed deployed api on stage server on graphql-api.flipt.staging.domandtom.com
i just implementing front-end in react
v
I guess it is a cors problem, have you set it up on your server
?
d
no
in old version we can set cors using createNetworkInterface
v
this should be set on server
d
i fixed the cors issue by
Copy code
const httpLink = createHttpLink({
  uri: '<http://graphql-api.flipt.staging.domandtom.com/>',
  fetchOptions: {
    mode: 'no-cors'
  }
});
👍 1
now it's header changed to 'text/plain' instead 'application/json'