diff --git a/src/module.ts b/src/module.ts index 18d607a..5f9b158 100644 --- a/src/module.ts +++ b/src/module.ts @@ -5,8 +5,8 @@ export interface ModuleOptions { apiKey: string apiDomain: string verbose: boolean - userFromAuthUtils: boolean - authUtilsUserFields: string[] + authUtils: boolean + authUtilsFields: string[] } declare module 'nuxt/schema' { @@ -37,13 +37,13 @@ declare module 'nuxt/schema' { * @default false */ - userFromAuthUtils?: boolean + authUtils?: boolean /** * Customize the fields that are plucked from the user supplied from nuxt-auth-utils * * @default ['id', 'email', 'name', 'avatar'] */ - authUtilsUserFields?: string[] + authUtilsFields?: string[] } } } diff --git a/src/runtime/care.ts b/src/runtime/care.ts index d158980..42409ed 100644 --- a/src/runtime/care.ts +++ b/src/runtime/care.ts @@ -30,8 +30,8 @@ interface ErrorMeta { export const careConfigDefaults = { apiDomain: 'https://fume.care', verbose: false, - userFromAuthUtils: false, - authUtilsUserFields: ['id', 'email', 'name', 'avatar'], + authUtils: false, + authUtilsFields: ['id', 'email', 'name', 'avatar'], } const mergeConfig = (config: Config) => { @@ -66,15 +66,15 @@ const getMeta = async (config: Config, event?: H3Event) => { const meta: ErrorMeta = { user: undefined, meta: undefined } // if we are incorporating nuxt-auth-utils in app/ - if (config.userFromAuthUtils && !event && typeof useUserSession === 'function') { + if (config.authUtils && !event && typeof useUserSession === 'function') { const { user } = useUserSession() - meta.user = userFromFields(user.value, config.authUtilsUserFields) + meta.user = userFromFields(user.value, config.authUtilsFields) } // if we are incorporating nuxt-auth-utils in server/ - if (config.userFromAuthUtils && event && typeof getUserSession === 'function') { + if (config.authUtils && event && typeof getUserSession === 'function') { const { user } = await getUserSession(event) - meta.user = userFromFields(user, config.authUtilsUserFields) + meta.user = userFromFields(user, config.authUtilsFields) } if (config.verbose) log.info('[fume.care] stored meta being sent:', JSON.stringify(meta)) return meta