Skip to content

Commit

Permalink
Use dev url
Browse files Browse the repository at this point in the history
  • Loading branch information
benmerckx committed Oct 7, 2024
1 parent 11936ec commit a588b3a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/adapter/next/cms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class NextCMS<
const database = generatedStore.then(
store => new Database(this.config, store)
)
const resolver = database.then(
const dbResolver = database.then(
db => new EntryResolver(db, this.config.schema)
)
super(config, async () => {
Expand All @@ -56,10 +56,11 @@ export class NextCMS<
const payload = getPreviewPayloadFromCookies(cookie.getAll())
if (payload) resolveDefaults.preview = {payload}
}
if (devUrl()) return new Client({url, applyAuth, resolveDefaults})
const client = new NextClient(
{
async resolve(params) {
const dbResolver = await resolver
const resolver = await dbResolver
if (!params.preview && !isBuild) {
const syncInterval = params.syncInterval ?? 60
const now = Date.now()
Expand All @@ -69,7 +70,7 @@ export class NextCMS<
await db.syncWith(client).catch(() => {})
}
}
return dbResolver.resolve({...resolveDefaults, ...params})
return resolver.resolve({...resolveDefaults, ...params})
}
},
{
Expand Down

0 comments on commit a588b3a

Please sign in to comment.