mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
12 lines
261 B
JavaScript
12 lines
261 B
JavaScript
import { getSession } from 'next-auth/client'
|
|
|
|
export default async (req, res) => {
|
|
const session = await getSession({ req })
|
|
|
|
if (session) {
|
|
res.send({ content: 'Protected content.' })
|
|
} else {
|
|
res.send({ content: 'Unprotected content.' })
|
|
}
|
|
}
|