最近我们的Git存储库遇到了很多问题.我们是git子模块的用户,我们的应用程序之间共有4个共享存储库.
例如,存储库"网站"总共有3个子模块.
[submodule "vendor/api"]
path = vendor/api
url = git@your.cool.domain.com:api
[submodule "vendor/auth"]
path = vendor/auth
url = git@your.cool.domain.com:auth
[submodule "vendor/tools"]
path = vendor/tools
url = git@your.cool.domain.com:tools
Run Code Online (Sandbox Code Playgroud)
我们已经正确检查了我们的主存储库'网站'.现在,我的一位同事做了推动,然后我git pull; git status
:
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: vendor/api (new commits)
# modified: vendor/auth (new commits)
# modified: vendor/tools (new commits) …
Run Code Online (Sandbox Code Playgroud) 在尝试访问后端(Apollo GraphQL)时清除 NextAuth.js 会话的最佳方法是什么,并且由于令牌已过期或无效而返回 401?
我想到了errorLink
and signout
,但据我所知signout
不能在服务器端使用getServerSideProps
,而只能在客户端使用。
推荐的方法是什么?有没有其他方法可以实现中间件来处理这种情况?
这将是errorLink
我正在尝试实现的概念的证明,代码被困在其中,if
但我无法使用,signOut()
因为它仅在客户端可用。
const errorLink = onError(({ graphQLErrors }) => {
if (graphQLErrors?.[0]?.message === 'Unauthenticated.') {
// signOut();
}
});
function createApolloClient(session) {
return new ApolloClient({
cache: new InMemoryCache(),
ssrMode: typeof window === 'undefined',
link: from([
errorLink,
createUploadLink({
uri: GRAPHQL_URI,
credentials: 'same-origin',
headers: { Authorization: session?.accessToken ? `Bearer ${session.accessToken}` : '' },
}),
]),
});
}
Run Code Online (Sandbox Code Playgroud)
谢谢