Markdown editor in progress + Login and session process completed

This commit is contained in:
2024-08-19 16:27:09 +02:00
parent aba56bb034
commit 2e92c389a2
74 changed files with 1305 additions and 313 deletions

View File

@@ -0,0 +1,7 @@
export default defineNuxtPlugin(async (nuxtApp) => {
if (!nuxtApp.payload.serverRendered || Boolean(nuxtApp.payload.prerenderedAt) || Boolean(nuxtApp.payload.isCached)) {
nuxtApp.hook('app:mounted', async () => {
await useUserSession().fetch()
})
}
})

11
plugins/session.server.ts Normal file
View File

@@ -0,0 +1,11 @@
export default defineNuxtPlugin({
name: 'session-fetch-plugin',
enforce: 'pre',
async setup(nuxtApp) {
// Flag if request is cached
nuxtApp.payload.isCached = Boolean(useRequestEvent()?.context.cache)
if (nuxtApp.payload.serverRendered && !nuxtApp.payload.prerenderedAt && !nuxtApp.payload.isCached) {
await useUserSession().fetch()
}
},
})