Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { withData } from 'next-apollo';
import { HttpLink } from 'apollo-link-http';
import fetch from 'node-fetch';
// can also be a function that accepts a `context` object (SSR only) and returns a config
const config = {
link: new HttpLink({ uri: '/admin/api', fetch }),
onError: e => {
console.error(e.graphQLErrors);
},
};
export default withData(config);
import { HttpLink } from "apollo-link-http";
import { withData } from "next-apollo";
const config = {
link: new HttpLink({
uri: "http://localhost:1337/graphql", // Server URL (must be absolute)
opts: {
credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
}
})
};
export default withData(config);
/* /lib/apollo.js */
import { HttpLink } from "apollo-link-http";
import { withData } from "next-apollo";
const config = {
link: new HttpLink({
uri: "http://localhost:1337/graphql", // Server URL (must be absolute)
opts: {
credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
}
})
};
export default withData(config);
import { withData } from "next-apollo";
import { HttpLink } from "apollo-boost";
const config = {
link: new HttpLink({
uri: "https://api.graph.cool/simple/v1/cixmkt2ul01q00122mksg82pn", // Server URL (must be absolute)
opts: {
credentials: "same-origin" // Additional fetch() options like `credentials` or `headers`
}
})
};
export default withData(config);
import { withData } from 'next-apollo'
import { HttpLink } from 'apollo-link-http'
const config = {
link: new HttpLink({
uri: 'http://localhost:8080/v1/graphql', // <- Configure GraphQL Server URL (must be absolute)
})
}
export default withData(config)
return defaultDataIdFromObject(object);
}
}
const config = {
link: new BatchHttpLink({
uri: `${PUBLIC_API_URL}/graphql`, // Server URL (must be absolute)
headers,
credentials: 'include', // Additional fetch() options like `credentials` or `headers`
}),
createCache() {
return new InMemoryCache({ dataIdFromObject: customIdMapper });
},
};
export default withData(config);