Unverified Commit c634d761 authored by Hannes Bornö's avatar Hannes Bornö Committed by GitHub

ReferenceError in authentication.md example fixed (#33411)

Before
```jsx
export const getServerSideProps = withSession(async function ({ req, res }) {
  if (!req.session.user) {
    return {
      redirect: {
        destination: '/login',
        permanent: false,
      },
    }
  }

  return {
    props: { user }, // User not defined
  }
})
```
parent 41614e52
...@@ -71,7 +71,9 @@ import withSession from '../lib/session' ...@@ -71,7 +71,9 @@ import withSession from '../lib/session'
import Layout from '../components/Layout' import Layout from '../components/Layout'
export const getServerSideProps = withSession(async function ({ req, res }) { export const getServerSideProps = withSession(async function ({ req, res }) {
if (!req.session.user) { const { user } = req.session
if (!user) {
return { return {
redirect: { redirect: {
destination: '/login', destination: '/login',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment