This commit is contained in:
parent
a27c335113
commit
3d4499fb80
@ -60,14 +60,14 @@ export default buildConfig({
|
|||||||
async onInit(payload) {
|
async onInit(payload) {
|
||||||
const existingUsers = await payload.find({
|
const existingUsers = await payload.find({
|
||||||
collection: 'users',
|
collection: 'users',
|
||||||
limit: 1,
|
limit: 2,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (existingUsers.docs.length === 0) {
|
if (existingUsers.docs.length === 0 || existingUsers.docs.length === 1) {
|
||||||
await payload.create({
|
await payload.create({
|
||||||
collection: 'users',
|
collection: 'users',
|
||||||
data: {
|
data: {
|
||||||
email: 'dev@payloadcms.com',
|
email: 'admin@nextload.test',
|
||||||
password: 'test',
|
password: 'test',
|
||||||
roles: ['admin'],
|
roles: ['admin'],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user