fix: seed-admin route must not destroy shared payload pool

This commit is contained in:
flym 2026-09-10 01:21:55 +08:00
parent 14d26c765a
commit e5492ceccb

View File

@ -18,7 +18,6 @@ export const POST = async () => {
const payload = await getPayload({ config });
const existing = await payload.find({ collection: "users", limit: 1, pagination: false });
if (existing.totalDocs > 0) {
await payload.destroy();
return Response.json({ ok: false, error: "user exists" }, { status: 409 });
}
@ -27,6 +26,5 @@ export const POST = async () => {
data: { email, password, displayName: "CMS Admin" },
overrideAccess: true,
});
await payload.destroy();
return Response.json({ ok: true });
};