Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
ebe4bb1e
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ebe4bb1e
编写于
7月 25, 2020
作者:
D
David Stotijn
提交者:
GitHub
7月 25, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upgrade Apollo Client to 3.0 in `examples/api-routes-apollo-server-and-client-auth` (#15272)
上级
574fe0b5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
11 addition
and
22 deletion
+11
-22
examples/api-routes-apollo-server-and-client-auth/apollo/client.js
...api-routes-apollo-server-and-client-auth/apollo/client.js
+3
-4
examples/api-routes-apollo-server-and-client-auth/apollo/type-defs.js
...-routes-apollo-server-and-client-auth/apollo/type-defs.js
+1
-1
examples/api-routes-apollo-server-and-client-auth/package.json
...les/api-routes-apollo-server-and-client-auth/package.json
+1
-8
examples/api-routes-apollo-server-and-client-auth/pages/_app.js
...es/api-routes-apollo-server-and-client-auth/pages/_app.js
+1
-1
examples/api-routes-apollo-server-and-client-auth/pages/index.js
...s/api-routes-apollo-server-and-client-auth/pages/index.js
+1
-2
examples/api-routes-apollo-server-and-client-auth/pages/signin.js
.../api-routes-apollo-server-and-client-auth/pages/signin.js
+2
-2
examples/api-routes-apollo-server-and-client-auth/pages/signout.js
...api-routes-apollo-server-and-client-auth/pages/signout.js
+1
-2
examples/api-routes-apollo-server-and-client-auth/pages/signup.js
.../api-routes-apollo-server-and-client-auth/pages/signup.js
+1
-2
未找到文件。
examples/api-routes-apollo-server-and-client-auth/apollo/client.js
浏览文件 @
ebe4bb1e
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
ApolloClient
}
from
'
apollo-client
'
import
{
ApolloClient
,
InMemoryCache
}
from
'
@apollo/client
'
import
{
InMemoryCache
}
from
'
apollo-cache-inmemory
'
let
apolloClient
let
apolloClient
function
createIsomorphLink
()
{
function
createIsomorphLink
()
{
if
(
typeof
window
===
'
undefined
'
)
{
if
(
typeof
window
===
'
undefined
'
)
{
const
{
SchemaLink
}
=
require
(
'
apollo-link-
schema
'
)
const
{
SchemaLink
}
=
require
(
'
@apollo/client/link/
schema
'
)
const
{
schema
}
=
require
(
'
./schema
'
)
const
{
schema
}
=
require
(
'
./schema
'
)
return
new
SchemaLink
({
schema
})
return
new
SchemaLink
({
schema
})
}
else
{
}
else
{
const
{
HttpLink
}
=
require
(
'
apollo-link-
http
'
)
const
{
HttpLink
}
=
require
(
'
@apollo/client/link/
http
'
)
return
new
HttpLink
({
return
new
HttpLink
({
uri
:
'
/api/graphql
'
,
uri
:
'
/api/graphql
'
,
credentials
:
'
same-origin
'
,
credentials
:
'
same-origin
'
,
...
...
examples/api-routes-apollo-server-and-client-auth/apollo/type-defs.js
浏览文件 @
ebe4bb1e
import
gql
from
'
graphql-tag
'
import
{
gql
}
from
'
@apollo/client
'
export
const
typeDefs
=
gql
`
export
const
typeDefs
=
gql
`
type User {
type User {
...
...
examples/api-routes-apollo-server-and-client-auth/package.json
浏览文件 @
ebe4bb1e
...
@@ -7,18 +7,11 @@
...
@@ -7,18 +7,11 @@
"start"
:
"next start"
"start"
:
"next start"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@apollo/react-common"
:
"^3.1.4"
,
"@apollo/client"
:
"^3.0.2"
,
"@apollo/react-hooks"
:
"^3.1.5"
,
"@hapi/iron"
:
"6.0.0"
,
"@hapi/iron"
:
"6.0.0"
,
"apollo-cache-inmemory"
:
"^1.6.6"
,
"apollo-client"
:
"^2.6.10"
,
"apollo-link-http"
:
"^1.5.17"
,
"apollo-link-schema"
:
"^1.2.5"
,
"apollo-server-micro"
:
"^2.14.2"
,
"apollo-server-micro"
:
"^2.14.2"
,
"apollo-utilities"
:
"^1.3.2"
,
"cookie"
:
"^0.4.1"
,
"cookie"
:
"^0.4.1"
,
"graphql"
:
"^14.0.2"
,
"graphql"
:
"^14.0.2"
,
"graphql-tag"
:
"^2.10.3"
,
"next"
:
"latest"
,
"next"
:
"latest"
,
"prop-types"
:
"^15.6.2"
,
"prop-types"
:
"^15.6.2"
,
"react"
:
"^16.7.0"
,
"react"
:
"^16.7.0"
,
...
...
examples/api-routes-apollo-server-and-client-auth/pages/_app.js
浏览文件 @
ebe4bb1e
import
{
ApolloProvider
}
from
'
@apollo/
react-hooks
'
import
{
ApolloProvider
}
from
'
@apollo/
client
'
import
{
useApollo
}
from
'
../apollo/client
'
import
{
useApollo
}
from
'
../apollo/client
'
export
default
function
App
({
Component
,
pageProps
})
{
export
default
function
App
({
Component
,
pageProps
})
{
...
...
examples/api-routes-apollo-server-and-client-auth/pages/index.js
浏览文件 @
ebe4bb1e
import
{
useEffect
}
from
'
react
'
import
{
useEffect
}
from
'
react
'
import
{
useRouter
}
from
'
next/router
'
import
{
useRouter
}
from
'
next/router
'
import
Link
from
'
next/link
'
import
Link
from
'
next/link
'
import
gql
from
'
graphql-tag
'
import
{
gql
,
useQuery
}
from
'
@apollo/client
'
import
{
useQuery
}
from
'
@apollo/react-hooks
'
const
ViewerQuery
=
gql
`
const
ViewerQuery
=
gql
`
query ViewerQuery {
query ViewerQuery {
...
...
examples/api-routes-apollo-server-and-client-auth/pages/signin.js
浏览文件 @
ebe4bb1e
import
{
useState
}
from
'
react
'
import
{
useState
}
from
'
react
'
import
{
useRouter
}
from
'
next/router
'
import
{
useRouter
}
from
'
next/router
'
import
Link
from
'
next/link
'
import
Link
from
'
next/link
'
import
gql
from
'
graphql-tag
'
import
{
gql
}
from
'
@apollo/client
'
import
{
useMutation
,
useApolloClient
}
from
'
@apollo/
react-hooks
'
import
{
useMutation
,
useApolloClient
}
from
'
@apollo/
client
'
import
{
getErrorMessage
}
from
'
../lib/form
'
import
{
getErrorMessage
}
from
'
../lib/form
'
import
Field
from
'
../components/field
'
import
Field
from
'
../components/field
'
...
...
examples/api-routes-apollo-server-and-client-auth/pages/signout.js
浏览文件 @
ebe4bb1e
import
{
useEffect
}
from
'
react
'
import
{
useEffect
}
from
'
react
'
import
{
useRouter
}
from
'
next/router
'
import
{
useRouter
}
from
'
next/router
'
import
{
useMutation
,
useApolloClient
}
from
'
@apollo/react-hooks
'
import
{
gql
,
useMutation
,
useApolloClient
}
from
'
@apollo/client
'
import
gql
from
'
graphql-tag
'
const
SignOutMutation
=
gql
`
const
SignOutMutation
=
gql
`
mutation SignOutMutation {
mutation SignOutMutation {
...
...
examples/api-routes-apollo-server-and-client-auth/pages/signup.js
浏览文件 @
ebe4bb1e
import
{
useState
}
from
'
react
'
import
{
useState
}
from
'
react
'
import
{
useRouter
}
from
'
next/router
'
import
{
useRouter
}
from
'
next/router
'
import
Link
from
'
next/link
'
import
Link
from
'
next/link
'
import
gql
from
'
graphql-tag
'
import
{
gql
,
useMutation
}
from
'
@apollo/client
'
import
{
useMutation
}
from
'
@apollo/react-hooks
'
import
{
getErrorMessage
}
from
'
../lib/form
'
import
{
getErrorMessage
}
from
'
../lib/form
'
import
Field
from
'
../components/field
'
import
Field
from
'
../components/field
'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录