fix: bug with seeding ecommerce

This commit is contained in:
James
2023-10-16 18:34:10 -04:00
parent 9f0ef9b7da
commit 993568a195
3 changed files with 7 additions and 3 deletions

View File

@@ -167,11 +167,13 @@ export const seed = async (payload: Payload): Promise<void> => {
payload.logger.info(`— Seeding products page...`)
let { id: productsPageID } = await payload.create({
const productsPageDoc = await payload.create({
collection: 'pages',
data: productsPage,
})
let productsPageID = productsPageDoc.id
if (payload.db.defaultIDType === 'text') {
productsPageID = `"${productsPageID}"`
}
@@ -202,7 +204,7 @@ export const seed = async (payload: Payload): Promise<void> => {
await payload.updateGlobal({
slug: 'settings',
data: {
productsPage: productsPageID,
productsPage: productsPageDoc.id,
},
})
@@ -217,7 +219,7 @@ export const seed = async (payload: Payload): Promise<void> => {
type: 'reference',
reference: {
relationTo: 'pages',
value: productsPageID,
value: productsPageDoc.id,
},
label: 'Shop',
},

View File

@@ -17,6 +17,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"sourceMap": true,
"isolatedModules": true,
"plugins": [
{

View File

@@ -5,6 +5,7 @@
"outDir": "dist",
"noEmit": false,
"jsx": "react",
"sourceMap": true,
},
"include": [
"src/server.ts",