Skip to content

Commit

Permalink
Update to 3.0 in api-routes-apollo-server-and-client example (#15270)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstotijn authored Jul 17, 2020
1 parent 5e9f310 commit 48621b3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
7 changes: 3 additions & 4 deletions examples/api-routes-apollo-server-and-client/apollo/client.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { useMemo } from 'react'
import { ApolloClient } from 'apollo-client'
import { InMemoryCache } from 'apollo-cache-inmemory'
import { ApolloClient, InMemoryCache } from '@apollo/client'

let apolloClient

function createIsomorphLink() {
if (typeof window === 'undefined') {
const { SchemaLink } = require('apollo-link-schema')
const { SchemaLink } = require('@apollo/client/link/schema')
const { schema } = require('./schema')
return new SchemaLink({ schema })
} else {
const { HttpLink } = require('apollo-link-http')
const { HttpLink } = require('@apollo/client/link/http')
return new HttpLink({
uri: '/api/graphql',
credentials: 'same-origin',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import gql from 'graphql-tag'
import { gql } from '@apollo/client'

export const typeDefs = gql`
type User {
Expand Down
9 changes: 1 addition & 8 deletions examples/api-routes-apollo-server-and-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@
"start": "next start"
},
"dependencies": {
"@apollo/react-common": "^3.1.4",
"@apollo/react-hooks": "^3.1.5",
"apollo-cache-inmemory": "^1.6.6",
"apollo-client": "^2.6.10",
"apollo-link-http": "^1.5.17",
"apollo-link-schema": "^1.2.5",
"@apollo/client": "^3.0.2",
"apollo-server-micro": "^2.14.2",
"apollo-utilities": "^1.3.2",
"graphql": "^14.0.2",
"graphql-tag": "2.10.3",
"next": "latest",
"prop-types": "^15.6.2",
"react": "^16.7.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/api-routes-apollo-server-and-client/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApolloProvider } from '@apollo/react-hooks'
import { ApolloProvider } from '@apollo/client'
import { useApollo } from '../apollo/client'

export default function App({ Component, pageProps }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import gql from 'graphql-tag'
import Link from 'next/link'
import { useQuery } from '@apollo/react-hooks'
import { useQuery } from '@apollo/client'
import { initializeApollo } from '../apollo/client'

const ViewerQuery = gql`
Expand Down

0 comments on commit 48621b3

Please sign in to comment.