Implemented getCsrfToken as per auth-next docs, getCsrfToken is required by webpack5 (fixes #123, thanks @jacobocode)

pull/124/head
Alex van Andel 2021-04-30 21:14:26 +00:00
parent ea31607598
commit 7b8d0b1119
1 changed files with 7 additions and 7 deletions

View File

@ -1,5 +1,5 @@
import Head from 'next/head'; import Head from 'next/head';
import { csrfToken } from 'next-auth/client'; import { getCsrfToken } from 'next-auth/client';
export default function Login({ csrfToken }) { export default function Login({ csrfToken }) {
return ( return (
@ -48,8 +48,8 @@ export default function Login({ csrfToken }) {
) )
} }
Login.getInitialProps = async (context) => { Login.getInitialProps = async ({ req, res }) => {
return { return {
csrfToken: await csrfToken(context) csrfToken: await getCsrfToken({ req })
} }
} }