1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
0 Redirecting in `getInitialProps`
Tim Neutkens edited this page 2019-06-09 08:24:21 -07:00
import React from 'react'
import Router from 'next/router'

export default class extends React.Component {
  static async getInitialProps({ res }) {
    if (res) {
      res.writeHead(302, {
        Location: '/about'
      })
      res.end()
    } else {
      Router.push('/about')
    }
    return {}
  }
}