nuxt-auth-utils 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -195,12 +195,15 @@ We leverage hooks to let you extend the session data with your own data or to lo
195
195
  ```ts
196
196
  // server/plugins/session.ts
197
197
  export default defineNitroPlugin(() => {
198
- sessionHooks.hook('verify', async (session, event) => {
198
+ // Called when the session is fetched during SSR for the Vue composable (/api/_auth/session)
199
+ // Or when we call useUserSession().fetch()
200
+ sessionHooks.hook('fetch', async (session, event) => {
199
201
  // extend User Session by calling your database
200
202
  // or
201
203
  // throw createError({ ... }) if session is invalid for example
202
204
  })
203
205
 
206
+ // Called when we call useServerSession().clear() or clearUserSession(event)
204
207
  sessionHooks.hook('clear', async (session, event) => {
205
208
  // Log that user logged out
206
209
  })
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "auth-utils",
3
3
  "configKey": "auth",
4
- "version": "0.0.12"
4
+ "version": "0.0.13"
5
5
  }
@@ -2,6 +2,6 @@ import { eventHandler } from "h3";
2
2
  import { requireUserSession, sessionHooks } from "../utils/session.mjs";
3
3
  export default eventHandler(async (event) => {
4
4
  const session = await requireUserSession(event);
5
- await sessionHooks.callHookParallel("verify", session, event);
5
+ await sessionHooks.callHookParallel("fetch", session, event);
6
6
  return session;
7
7
  });
@@ -6,7 +6,7 @@ export interface SessionHooks {
6
6
  * - Add extra properties to the session
7
7
  * - Throw an error if the session could not be verified (with a database for example)
8
8
  */
9
- 'verify': (session: UserSession, event: H3Event) => void | Promise<void>;
9
+ 'fetch': (session: UserSession, event: H3Event) => void | Promise<void>;
10
10
  /**
11
11
  * Called before clearing the session
12
12
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-auth-utils",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Minimalist Auth module for Nuxt with SSR",
5
5
  "repository": "Atinux/nuxt-auth-utils",
6
6
  "license": "MIT",