Skip to content

Commit

Permalink
chore: client public config composable
Browse files Browse the repository at this point in the history
  • Loading branch information
smarroufin committed Feb 5, 2024
1 parent b6a9715 commit 3cfc682
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _nuxthub/composables/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function useConfig() {
return useState<Config['public']>('hub_config')
}
5 changes: 5 additions & 0 deletions _nuxthub/plugins/config.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default defineNuxtPlugin((nuxtApp) => {
const event = useRequestEvent()

useState('hub_config', () => event?.context.config?.public || {})
})

0 comments on commit 3cfc682

Please sign in to comment.