Skip to content

Commit

Permalink
chore: rename fn; use correct type
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikstrasser committed Oct 25, 2024
1 parent 29ba43c commit 40b9ec3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { defineNuxtPlugin, useRequestEvent, useRuntimeConfig } from '#app'
let status: 'initial_load' | 'idle' | 'updating' = 'initial_load'
const serverDcuplInstance = new DcuplInstance('server')

const initializeAndUpdateServerClient = async (dcupl: DcuplModuleOptions) => {
const initializeOrUpdateServerClient = async (dcupl: DcuplModuleOptions) => {
const shouldUpdate = await serverDcuplInstance.shouldUpdate()
if (shouldUpdate) {
if (status === 'initial_load') {
Expand All @@ -26,17 +26,17 @@ const initializeAndUpdateServerClient = async (dcupl: DcuplModuleOptions) => {
}

export default defineNuxtPlugin(async (_nuxtApp) => {
const { dcupl } = useRuntimeConfig().public as { dcupl: DcuplModuleOptions }
const sessionDcuplInstance = new DcuplInstance('session', dcupl)
const { dcupl: dcuplConfig } = useRuntimeConfig().public
const sessionDcuplInstance = new DcuplInstance('session', dcuplConfig)
if (import.meta.server) {
await initializeAndUpdateServerClient(dcupl)
await initializeOrUpdateServerClient(dcuplConfig)
const event = useRequestEvent()
if (event) {
event.context._dcupl = serverDcuplInstance.dcupl
}
}
else {
await sessionDcuplInstance.init(dcupl)
await sessionDcuplInstance.init(dcuplConfig)
}

return {
Expand Down

0 comments on commit 40b9ec3

Please sign in to comment.