Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
: null;
const splitLink = process.browser
? split(
({ query }) => {
const definition = getMainDefinition(query);
return definition.kind === "OperationDefinition" && definition.operation === "subscription";
},
wsLink,
httpLink
)
: httpLink;
const client = new ApolloClient({
link: splitLink,
cache: new InMemoryCache(),
});
const SupersenseApp = ({ Component, pageProps }: AppProps) => {
return (
);
};
// Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to
// perform automatic static optimization, causing every page in your app to
// be server-side rendered.
export default function App() {
const client = new ApolloClient({
link: new HttpLink({
credentials: 'same-origin',
fetch: authenticatedFetch(window.app), // created in shopify_app.js
uri: '/graphql'
}),
cache: new InMemoryCache()
});
return (
const splitLink = split(
({ query }) => {
const definition = getMainDefinition(query);
return (
definition.kind === "OperationDefinition" &&
definition.operation === "subscription"
);
},
wsLink,
httpLink,
);
const client = new ApolloClient({
link: splitLink,
cache: new InMemoryCache(),
});
interface AppProps {}
function App({}: AppProps) {
return (
);
.then(config => {
if (!config) throw new Error("Could not load config");
const client = new ApolloClient({
name: "Apollo CLI",
version,
link: new HttpLink({
uri: config.engine.endpoint,
headers: {
"x-api-key": config.engine.apiKey || service,
"apollo-client-reference-id": referenceID
},
fetch: fetch as any
}),
cache: new InMemoryCache()
});
setCommandReady({
client,
config,
oclif
});
})
.catch(e => console.error(e));
import { ApolloClient, InMemoryCache } from '@apollo/client';
import introspectionResult from './fragmentTypes';
const client = new ApolloClient({
uri: '/graphql',
cache: new InMemoryCache({
possibleTypes: introspectionResult.possibleTypes,
}),
});
export default client;
function createApolloClient() {
return new ApolloClient({
ssrMode: typeof window === "undefined",
link: new HttpLink({
uri: "/api/graphql/",
}),
cache: new InMemoryCache({
typePolicies: {
Project: {
keyFields: ["name"],
},
},
}),
});
}
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router } from 'react-router-dom';
import App from './App';
import keys from './keys';
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
const client = new ApolloClient({
uri: 'https://api.github.com/graphql',
headers: {
authorization: `bearer ${keys.github}`
},
cache: new InMemoryCache()
});
ReactDOM.render(
,
document.getElementById('root')
);
import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const ALL_COUNTRIES = gql`
query AllCountries {
countries @client {
code
name
emoji
}
}
`;
const client = new ApolloClient({
cache: new InMemoryCache(),
resolvers: {
Query: {
countries() {
return [
{
code: "AD",
emoji: "🇦🇩",
name: "Andorra",
__typename: "Country"
},
{
code: "AE",
emoji: "🇦🇪",
name: "United Arab Emirates",
__typename: "Country"
}