Initial commit from monorepo
This commit is contained in:
15
app/plugins/logto-user.server.ts
Normal file
15
app/plugins/logto-user.server.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export default defineNuxtPlugin(() => {
|
||||
const nuxtApp = useNuxtApp()
|
||||
const logtoUser = nuxtApp.ssrContext?.event.context.logtoUser ?? null
|
||||
const orgId = (logtoUser as { organizations?: string[] } | null)?.organizations?.[0] ?? null
|
||||
|
||||
const userState = useState('logto-user', () => null)
|
||||
const orgState = useState<string | null>('logto-org-id', () => null)
|
||||
|
||||
if (logtoUser) {
|
||||
userState.value = logtoUser
|
||||
}
|
||||
if (orgId) {
|
||||
orgState.value = orgId
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user