aborn / nuxt-openid-connect

OpenID-Connect(OIDC) integration module for nuxt 3.0.
31 stars 16 forks source link

feat: add composable `useOidc` #15

Closed trijpstra-fourlights closed 1 year ago

trijpstra-fourlights commented 1 year ago

I added a composable to the plugin.

While it's a preference, IMO it allows for slightly cleaner code while using this module. Furthermore, having it in allows the developer to choose how to interact with the module.

e.g.

const { login } = useOidc()
await login('/secure')

instead of

const { $oidc } = useNuxtApp()
await $oidc.login('/secure')

or

const { $oidc: { login } } = useNuxtApp()
await login('/secure')
aborn commented 1 year ago

Nice work, thanks a lot!