chore(examples/auth): migrates to 2.0 (#3506)

This commit is contained in:
Jacob Fletcher
2023-10-09 14:00:38 -04:00
committed by GitHub
parent 2de36550ae
commit 62679baa91
30 changed files with 2046 additions and 5851 deletions

View File

@@ -1 +1 @@
NEXT_PUBLIC_CMS_URL=http://localhost:3000 NEXT_PUBLIC_PAYLOAD_URL=http://localhost:3000

View File

@@ -8,7 +8,7 @@ export const USER = `
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export const gql = async (query: string): Promise<any> => { export const gql = async (query: string): Promise<any> => {
try { try {
const res = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/graphql`, { const res = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/graphql`, {
method: 'POST', method: 'POST',
credentials: 'include', credentials: 'include',
headers: { headers: {

View File

@@ -18,7 +18,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const create = useCallback<Create>( const create = useCallback<Create>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users`, args) const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, args)
setUser(user) setUser(user)
return user return user
} }
@@ -40,7 +40,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const login = useCallback<Login>( const login = useCallback<Login>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/login`, args) const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/login`, args)
setUser(user) setUser(user)
return user return user
} }
@@ -64,7 +64,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const logout = useCallback<Logout>(async () => { const logout = useCallback<Logout>(async () => {
if (api === 'rest') { if (api === 'rest') {
await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/logout`) await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/logout`)
setUser(null) setUser(null)
return return
} }
@@ -83,7 +83,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const fetchMe = async () => { const fetchMe = async () => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest( const user = await rest(
`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/me`, `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/me`,
{}, {},
{ {
method: 'GET', method: 'GET',
@@ -113,7 +113,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest( const user = await rest(
`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/forgot-password`, `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
args, args,
) )
setUser(user) setUser(user)
@@ -134,7 +134,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const resetPassword = useCallback<ResetPassword>( const resetPassword = useCallback<ResetPassword>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/reset-password`, args) const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,
args,
)
setUser(user) setUser(user)
return user return user
} }

View File

@@ -14,7 +14,7 @@ export const getMeUser = async (args?: {
const cookieStore = cookies() const cookieStore = cookies()
const token = cookieStore.get('payload-token')?.value const token = cookieStore.get('payload-token')?.value
const meUserReq = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/me`, { const meUserReq = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/me`, {
headers: { headers: {
Authorization: `JWT ${token}`, Authorization: `JWT ${token}`,
}, },

View File

@@ -39,15 +39,18 @@ export const AccountForm: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
if (user) { if (user) {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/${user.id}`, { const response = await fetch(
// Make sure to include cookies with fetch `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/${user.id}`,
credentials: 'include', {
method: 'PATCH', // Make sure to include cookies with fetch
body: JSON.stringify(data), credentials: 'include',
headers: { method: 'PATCH',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
const json = await response.json() const json = await response.json()

View File

@@ -22,7 +22,7 @@ export default async function Account() {
<h1>Account</h1> <h1>Account</h1>
<p> <p>
{`This is your account dashboard. Here you can update your account information and more. To manage all users, `} {`This is your account dashboard. Here you can update your account information and more. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -38,7 +38,7 @@ export const CreateAccountForm: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users`, { const response = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, {
method: 'POST', method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
@@ -75,7 +75,7 @@ export const CreateAccountForm: React.FC = () => {
<form onSubmit={handleSubmit(onSubmit)} className={classes.form}> <form onSubmit={handleSubmit(onSubmit)} className={classes.form}>
<p> <p>
{`This is where new customers can signup and create a new account. To manage all users, `} {`This is where new customers can signup and create a new account. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -57,7 +57,7 @@ export const LoginForm: React.FC = () => {
{' with the password '} {' with the password '}
<b>demo</b> <b>demo</b>
{'. To manage your users, '} {'. To manage your users, '}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
. .

View File

@@ -35,7 +35,7 @@ export default function Home() {
{' to start the authentication flow. Once logged in, you will be redirected to the '} {' to start the authentication flow. Once logged in, you will be redirected to the '}
<Link href="/account">account page</Link> <Link href="/account">account page</Link>
{` which is restricted to users only. To manage all users, `} {` which is restricted to users only. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -25,13 +25,16 @@ export const RecoverPasswordForm: React.FC = () => {
} = useForm<FormData>() } = useForm<FormData>()
const onSubmit = useCallback(async (data: FormData) => { const onSubmit = useCallback(async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/forgot-password`, { const response = await fetch(
method: 'POST', `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
body: JSON.stringify(data), {
headers: { method: 'POST',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
setSuccess(true) setSuccess(true)
@@ -52,7 +55,7 @@ export const RecoverPasswordForm: React.FC = () => {
<p> <p>
{`Please enter your email below. You will receive an email message with instructions on {`Please enter your email below. You will receive an email message with instructions on
how to reset your password. To manage your all users, `} how to reset your password. To manage your all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -32,13 +32,16 @@ export const ResetPasswordForm: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/reset-password`, { const response = await fetch(
method: 'POST', `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,
body: JSON.stringify(data), {
headers: { method: 'POST',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
const json = await response.json() const json = await response.json()

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
NEXT_PUBLIC_CMS_URL=http://localhost:3000 NEXT_PUBLIC_PAYLOAD_URL=http://localhost:3000

View File

@@ -40,15 +40,18 @@ const Account: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
if (user) { if (user) {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/${user.id}`, { const response = await fetch(
// Make sure to include cookies with fetch `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/${user.id}`,
credentials: 'include', {
method: 'PATCH', // Make sure to include cookies with fetch
body: JSON.stringify(data), credentials: 'include',
headers: { method: 'PATCH',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
const json = await response.json() const json = await response.json()
@@ -91,7 +94,7 @@ const Account: React.FC = () => {
<h1>Account</h1> <h1>Account</h1>
<p> <p>
{`This is your account dashboard. Here you can update your account information and more. To manage all users, `} {`This is your account dashboard. Here you can update your account information and more. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -38,7 +38,7 @@ const CreateAccount: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users`, { const response = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, {
method: 'POST', method: 'POST',
body: JSON.stringify(data), body: JSON.stringify(data),
headers: { headers: {
@@ -78,7 +78,7 @@ const CreateAccount: React.FC = () => {
<form onSubmit={handleSubmit(onSubmit)} className={classes.form}> <form onSubmit={handleSubmit(onSubmit)} className={classes.form}>
<p> <p>
{`This is where new customers can signup and create a new account. To manage all users, `} {`This is where new customers can signup and create a new account. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -35,7 +35,7 @@ export default function Home() {
{' to start the authentication flow. Once logged in, you will be redirected to the '} {' to start the authentication flow. Once logged in, you will be redirected to the '}
<Link href="/account">account page</Link> <Link href="/account">account page</Link>
{` which is restricted to users only. To manage all users, `} {` which is restricted to users only. To manage all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -60,7 +60,7 @@ const Login: React.FC = () => {
{' with the password '} {' with the password '}
<b>demo</b> <b>demo</b>
{'. To manage your users, '} {'. To manage your users, '}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
. .

View File

@@ -24,13 +24,16 @@ const RecoverPassword: React.FC = () => {
} = useForm<FormData>() } = useForm<FormData>()
const onSubmit = useCallback(async (data: FormData) => { const onSubmit = useCallback(async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/forgot-password`, { const response = await fetch(
method: 'POST', `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
body: JSON.stringify(data), {
headers: { method: 'POST',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
setSuccess(true) setSuccess(true)
@@ -51,7 +54,7 @@ const RecoverPassword: React.FC = () => {
<p> <p>
{`Please enter your email below. You will receive an email message with instructions on {`Please enter your email below. You will receive an email message with instructions on
how to reset your password. To manage your all users, `} how to reset your password. To manage your all users, `}
<Link href={`${process.env.NEXT_PUBLIC_CMS_URL}/admin/collections/users`}> <Link href={`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/admin/collections/users`}>
login to the admin dashboard login to the admin dashboard
</Link> </Link>
{'.'} {'.'}

View File

@@ -31,13 +31,16 @@ const ResetPassword: React.FC = () => {
const onSubmit = useCallback( const onSubmit = useCallback(
async (data: FormData) => { async (data: FormData) => {
const response = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/reset-password`, { const response = await fetch(
method: 'POST', `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,
body: JSON.stringify(data), {
headers: { method: 'POST',
'Content-Type': 'application/json', body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
},
}, },
}) )
if (response.ok) { if (response.ok) {
const json = await response.json() const json = await response.json()

View File

@@ -8,7 +8,7 @@ export const USER = `
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
export const gql = async (query): Promise<any> => { export const gql = async (query): Promise<any> => {
try { try {
const res = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/graphql`, { const res = await fetch(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/graphql`, {
method: 'POST', method: 'POST',
credentials: 'include', credentials: 'include',
headers: { headers: {

View File

@@ -16,7 +16,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const create = useCallback<Create>( const create = useCallback<Create>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users`, args) const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users`, args)
setUser(user) setUser(user)
return user return user
} }
@@ -38,7 +38,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const login = useCallback<Login>( const login = useCallback<Login>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/login`, args) const user = await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/login`, args)
setUser(user) setUser(user)
return user return user
} }
@@ -62,7 +62,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const logout = useCallback<Logout>(async () => { const logout = useCallback<Logout>(async () => {
if (api === 'rest') { if (api === 'rest') {
await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/logout`) await rest(`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/logout`)
setUser(null) setUser(null)
return return
} }
@@ -81,7 +81,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const fetchMe = async () => { const fetchMe = async () => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest( const user = await rest(
`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/me`, `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/me`,
{}, {},
{ {
method: 'GET', method: 'GET',
@@ -111,7 +111,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest( const user = await rest(
`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/forgot-password`, `${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/forgot-password`,
args, args,
) )
setUser(user) setUser(user)
@@ -132,7 +132,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode; api?: 'rest' |
const resetPassword = useCallback<ResetPassword>( const resetPassword = useCallback<ResetPassword>(
async args => { async args => {
if (api === 'rest') { if (api === 'rest') {
const user = await rest(`${process.env.NEXT_PUBLIC_CMS_URL}/api/users/reset-password`, args) const user = await rest(
`${process.env.NEXT_PUBLIC_PAYLOAD_URL}/api/users/reset-password`,
args,
)
setUser(user) setUser(user)
return user return user
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
PAYLOAD_PUBLIC_SITE_URL=http://localhost:3001 PAYLOAD_PUBLIC_SITE_URL=http://localhost:3001
PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000 PAYLOAD_PUBLIC_SERVER_URL=http://localhost:3000
MONGODB_URI=mongodb://127.0.0.1/payload-example-auth DATABASE_URI=mongodb://127.0.0.1/payload-example-auth
PAYLOAD_SECRET=PAYLOAD_AUTH_EXAMPLE_SECRET_KEY PAYLOAD_SECRET=PAYLOAD_AUTH_EXAMPLE_SECRET_KEY
COOKIE_DOMAIN=localhost COOKIE_DOMAIN=localhost
PAYLOAD_PUBLIC_SEED=true PAYLOAD_PUBLIC_SEED=true

View File

@@ -17,6 +17,9 @@
"lint:fix": "eslint --fix --ext .ts,.tsx src" "lint:fix": "eslint --fix --ext .ts,.tsx src"
}, },
"dependencies": { "dependencies": {
"@payloadcms/bundler-webpack": "^1.0.0-beta.5",
"@payloadcms/db-mongodb": "^1.0.0-beta.8",
"@payloadcms/richtext-slate": "^1.0.0-beta.4",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"express": "^4.17.1", "express": "^4.17.1",
"payload": "latest" "payload": "latest"

View File

@@ -1,6 +1,7 @@
import type { User } from 'payload/generated-types'
import type { FieldHook } from 'payload/types' import type { FieldHook } from 'payload/types'
import type { User } from '../../payload-types'
// ensure there is always a `user` role // ensure there is always a `user` role
// do not let non-admins change roles // do not let non-admins change roles
export const protectRoles: FieldHook<User & { id: string }> = async ({ req, data }) => { export const protectRoles: FieldHook<User & { id: string }> = async ({ req, data }) => {

View File

@@ -8,23 +8,61 @@
export interface Config { export interface Config {
collections: { collections: {
users: User; users: User
}; 'payload-preferences': PayloadPreference
globals: {}; 'payload-migrations': PayloadMigration
}
globals: {}
} }
export interface User { export interface User {
id: string; id: string
firstName?: string; firstName?: string
lastName?: string; lastName?: string
roles?: ('admin' | 'user')[]; roles?: ('admin' | 'user')[]
updatedAt: string; updatedAt: string
createdAt: string; createdAt: string
email: string; email: string
resetPasswordToken?: string; resetPasswordToken?: string
resetPasswordExpiration?: string; resetPasswordExpiration?: string
salt?: string; salt?: string
hash?: string; hash?: string
loginAttempts?: number; loginAttempts?: number
lockUntil?: string; lockUntil?: string
password?: string; password?: string
}
export interface PayloadPreference {
id: string
user: {
relationTo: 'users'
value: string | User
}
key?: string
value?:
| {
[k: string]: unknown
}
| unknown[]
| string
| number
| boolean
| null
updatedAt: string
createdAt: string
}
export interface PayloadMigration {
id: string
name?: string
batch?: number
updatedAt: string
createdAt: string
}
declare module 'payload' {
export interface GeneratedTypes {
collections: {
users: User
'payload-preferences': PayloadPreference
'payload-migrations': PayloadMigration
}
}
} }

View File

@@ -1,3 +1,6 @@
import { webpackBundler } from '@payloadcms/bundler-webpack'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
import { slateEditor } from '@payloadcms/richtext-slate'
import path from 'path' import path from 'path'
import { buildConfig } from 'payload/config' import { buildConfig } from 'payload/config'
@@ -7,10 +10,15 @@ import BeforeLogin from './components/BeforeLogin'
export default buildConfig({ export default buildConfig({
collections: [Users], collections: [Users],
admin: { admin: {
bundler: webpackBundler(),
components: { components: {
beforeLogin: [BeforeLogin], beforeLogin: [BeforeLogin],
}, },
}, },
editor: slateEditor({}),
db: mongooseAdapter({
url: process.env.DATABASE_URI,
}),
cors: [ cors: [
process.env.PAYLOAD_PUBLIC_SERVER_URL || '', process.env.PAYLOAD_PUBLIC_SERVER_URL || '',
process.env.PAYLOAD_PUBLIC_SITE_URL || '', process.env.PAYLOAD_PUBLIC_SITE_URL || '',

View File

@@ -18,7 +18,6 @@ app.get('/', (_, res) => {
const start = async (): Promise<void> => { const start = async (): Promise<void> => {
await payload.init({ await payload.init({
secret: process.env.PAYLOAD_SECRET, secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI,
express: app, express: app,
onInit: () => { onInit: () => {
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`) payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)

View File

@@ -17,9 +17,6 @@
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,
"paths": { "paths": {
"payload/generated-types": [
"./src/payload-types.ts"
],
"node_modules/*": [ "node_modules/*": [
"./node_modules/*" "./node_modules/*"
] ]

File diff suppressed because it is too large Load Diff