FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Securing pages server-side · Gatodegithub/Next-JS-Tutorials@ab6472c · GitHub

Commit ab6472c

Browse files
committed
Securing pages server-side
1 parent a08014a commit ab6472c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎next-authentication/pages/blog.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { getSession, useSession } from 'next-auth/client'
33
function Blog({ data }) {
44
const [session] = useSession()
55
console.log({ session })
6+
67
return <h1>Blog page - {data}</h1>
78
}
89

@@ -13,9 +14,7 @@ export async function getServerSideProps(context) {
1314
if (!session) {
1415
return {
1516
redirect: {
16-
destination: `/api/auth/signin?callbackUrl=${encodeURIComponent(
17-
'http:localhost:3000/blog'
18-
)}`,
17+
destination: '/api/auth/signin?callbackUrl=http://localhost:3000/blog',
1918
permanent: false
2019
}
2120
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL