Skip to content

Commit c3468b7

Browse files
committed
Fix live preview not working
1 parent b23947b commit c3468b7

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/collections/Projects.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { AssertionError, deepStrictEqual } from 'assert' // Validation always ru
77
import { routing } from '@/i18n/routing'
88
import draftAccess from '@/lib/utils/access'
99
import purgeURL from '@/lib/utils/purge'
10+
import { PAYLOAD_SECRET } from '@/lib/secrets'
1011

1112
// Extracting it from imageConfig since there's an extra field for groups so I add it manually when setting the schema
1213
const desktopConfig: Field = {
@@ -136,7 +137,7 @@ export const Projects: CollectionConfig = {
136137
url: ({ data, locale }) => {
137138
const params = new URLSearchParams({
138139
path: `${locale}/projects/${data.id}`,
139-
secret: process.env.DRAFT_MODE_SECRET || '',
140+
secret: PAYLOAD_SECRET,
140141
})
141142

142143
return `/draft?${params.toString()}`

src/globals/Conclusion.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { routing } from '@/i18n/routing'
33
import { revalidatePath } from 'next/cache'
44
import draftAccess from '@/lib/utils/access'
55
import purgeRoute from '@/lib/utils/purge'
6+
import { PAYLOAD_SECRET } from '@/lib/secrets'
67

78
export const Conclusion: GlobalConfig = {
89
slug: 'conclusion',
@@ -16,7 +17,7 @@ export const Conclusion: GlobalConfig = {
1617
url: ({ locale }) => {
1718
const params = new URLSearchParams({
1819
path: `${locale}/conclusion`,
19-
secret: process.env.DRAFT_MODE_SECRET || '',
20+
secret: PAYLOAD_SECRET,
2021
})
2122

2223
return `/draft?${params.toString()}`

src/globals/MainPage.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import draftAccess from '@/lib/utils/access'
66
import { routing } from '@/i18n/routing'
77
import { revalidatePath } from 'next/cache'
88
import purgeRoute from '@/lib/utils/purge'
9+
import { PAYLOAD_SECRET } from '@/lib/secrets'
910

1011
const MainPage: GlobalConfig = {
1112
slug: 'mainPageImages',
@@ -16,7 +17,7 @@ const MainPage: GlobalConfig = {
1617
url: ({ locale }) => {
1718
const params = new URLSearchParams({
1819
path: `${locale}/`,
19-
secret: process.env.DRAFT_MODE_SECRET || '',
20+
secret: PAYLOAD_SECRET,
2021
})
2122

2223
return `/draft?${params.toString()}`

src/globals/Sculptures.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import draftAccess from '@/lib/utils/access'
44
import { routing } from '@/i18n/routing'
55
import { revalidatePath } from 'next/cache'
66
import purgeRoute from '@/lib/utils/purge'
7+
import { PAYLOAD_SECRET } from '@/lib/secrets'
78

89
export const Sculptures: GlobalConfig = {
910
slug: 'sculpture',
@@ -17,7 +18,7 @@ export const Sculptures: GlobalConfig = {
1718
url: ({ locale }) => {
1819
const params = new URLSearchParams({
1920
path: `${locale}/sculptures`,
20-
secret: process.env.DRAFT_MODE_SECRET || '',
21+
secret: PAYLOAD_SECRET,
2122
})
2223

2324
return `/draft?${params.toString()}`

0 commit comments

Comments
 (0)