fix: seed-admin route must not destroy shared payload pool
This commit is contained in:
parent
14d26c765a
commit
e5492ceccb
@ -18,7 +18,6 @@ export const POST = async () => {
|
|||||||
const payload = await getPayload({ config });
|
const payload = await getPayload({ config });
|
||||||
const existing = await payload.find({ collection: "users", limit: 1, pagination: false });
|
const existing = await payload.find({ collection: "users", limit: 1, pagination: false });
|
||||||
if (existing.totalDocs > 0) {
|
if (existing.totalDocs > 0) {
|
||||||
await payload.destroy();
|
|
||||||
return Response.json({ ok: false, error: "user exists" }, { status: 409 });
|
return Response.json({ ok: false, error: "user exists" }, { status: 409 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,6 +26,5 @@ export const POST = async () => {
|
|||||||
data: { email, password, displayName: "CMS Admin" },
|
data: { email, password, displayName: "CMS Admin" },
|
||||||
overrideAccess: true,
|
overrideAccess: true,
|
||||||
});
|
});
|
||||||
await payload.destroy();
|
|
||||||
return Response.json({ ok: true });
|
return Response.json({ ok: true });
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user