e112df4319
* Update to use the correct router instance in withRouter so error is thrown when router method is used during SSR * Revert changes to with-router and add error to methods on direct router instance * Extend Router and override methods with error instead * Update ServerRouter, add err.sh, and add test
8 lines
213 B
JavaScript
8 lines
213 B
JavaScript
import { withRouter } from 'next/router'
|
|
|
|
function RouterMethodSSR ({ router }) {
|
|
if (typeof window === 'undefined') router.push('/a')
|
|
return <p>Navigating...</p>
|
|
}
|
|
|
|
export default withRouter(RouterMethodSSR)
|