Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(examples): awaits getHeaders in auth example #10100

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ See the [Collections](https://payloadcms.com/docs/configuration/collections) doc
import config from '../../payload.config'

export default async function AccountPage({ searchParams }) {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config: configPromise })
const { permissions, user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AccountForm } from './AccountForm'
import classes from './index.module.scss'

export default async function Account() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { permissions, user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/create-account/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CreateAccountForm } from './CreateAccountForm'
import classes from './index.module.scss'

export default async function CreateAccount() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import classes from './index.module.scss'
import { LoginForm } from './LoginForm'

export default async function Login() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/logout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classes from './index.module.scss'
import { LogoutPage } from './LogoutPage'

export default async function Logout() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Gutter } from './_components/Gutter'
import { HydrateClientUser } from './_components/HydrateClientUser'

export default async function HomePage() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { permissions, user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/recover-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classes from './index.module.scss'
import { RecoverPasswordForm } from './RecoverPasswordForm'

export default async function RecoverPassword() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { user } = await payload.auth({ headers })

Expand Down
2 changes: 1 addition & 1 deletion examples/auth/src/app/(app)/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import classes from './index.module.scss'
import { ResetPasswordForm } from './ResetPasswordForm'

export default async function ResetPassword() {
const headers = getHeaders()
const headers = await getHeaders()
const payload = await getPayload({ config })
const { user } = await payload.auth({ headers })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Args = {
[key: string]: string | string[]
}>
}

export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams })

Expand Down