N
Nuxt2y ago
dmarr

Lazy AppConfig?

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.
4 Replies
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
dmarr
dmarrOP17mo ago
Ended up using plugins You can do something like:
export default defineNuxtPlugin(async () => {
await useFetch('/api/realm', { key: 'realm' })
});
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');
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
dmarr
dmarrOP17mo ago
either/both
Want results from more Discord servers?
Add your server