diff --git a/examples/api-routes-apollo-server-and-client-auth/pages/signin.js b/examples/api-routes-apollo-server-and-client-auth/pages/signin.js index d5a2acfb2ab7fab..766a4bd2ca41542 100644 --- a/examples/api-routes-apollo-server-and-client-auth/pages/signin.js +++ b/examples/api-routes-apollo-server-and-client-auth/pages/signin.js @@ -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)) diff --git a/examples/api-routes-apollo-server-and-client-auth/pages/signout.js b/examples/api-routes-apollo-server-and-client-auth/pages/signout.js index 2580af34888537a..0d18c898278162b 100644 --- a/examples/api-routes-apollo-server-and-client-auth/pages/signout.js +++ b/examples/api-routes-apollo-server-and-client-auth/pages/signout.js @@ -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

Signing out...