#Lazy AppConfig?

6 messages · Page 1 of 1 (latest)

fallen narwhal
#

Is there a way to have some kind of lazy app config? I would like to use defineAppConfig, but after the request comes in. Since my app uses subdomains, I would want different app configs based on the host requested.

keen valve
#

any luck?

fallen narwhal
#

Ended up using plugins

#

You can do something like:

#
export default defineNuxtPlugin(async () => {
  await useFetch('/api/realm', { key: 'realm' })
});

Then in your page you can access the data using useNuxtData:
const { data: realm } = useNuxtData('realm');

keen valve
#

Does it work on client side or server side?