Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve api-routes-apollo-server-and-client-auth Example #10358

Merged
merged 1 commit into from Jan 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -31,15 +31,15 @@ function SignIn() {
const passwordElement = event.currentTarget.elements.password

try {
await client.resetStore()
const { data } = await signIn({
variables: {
email: emailElement.value,
password: passwordElement.value,
},
})
client.resetStore()
if (data.signIn.user) {
router.push('/')
await router.push('/')
}
} catch (error) {
setErrorMsg(getErrorMessage(error))
Expand Down
Expand Up @@ -16,12 +16,11 @@ function SignOut() {
const [signOut] = useMutation(SignOutMutation)

React.useEffect(() => {
if (typeof window !== 'undefined') {
signOut().then(() => {
client.resetStore()
signOut().then(() => {
client.resetStore().then(() => {
router.push('/signin')
})
}
})
}, [signOut, router, client])

return <p>Signing out...</p>
Expand Down