Skip to content

Commit

Permalink
docs: add TS signature
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Jul 29, 2024
1 parent 4ba3289 commit 04a5d88
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Nuxt Auth Utils automatically adds some plugins to fetch the current user sessio

```vue
<script setup>
const { loggedIn, user, session, clear } = useUserSession()
const { loggedIn, user, session, fetch, clear } = useUserSession()
</script>
<template>
Expand All @@ -72,6 +72,37 @@ const { loggedIn, user, session, clear } = useUserSession()
</template>
```

**TypeScript Signature:**

```ts
interface UserSessionComposable {
/**
* Computed indicating if the auth session is ready
*/
ready: ComputedRef<boolean>
/**
* Computed indicating if the user is logged in.
*/
loggedIn: ComputedRef<boolean>
/**
* The user object if logged in, null otherwise.
*/
user: ComputedRef<User | null>
/**
* The session object.
*/
session: Ref<UserSession>
/**
* Fetch the user session from the server.
*/
fetch: () => Promise<void>
/**
* Clear the user session and remove the session cookie.
*/
clear: () => Promise<void>
}
```

## Server Utils

The following helpers are auto-imported in your `server/` directory.
Expand Down

0 comments on commit 04a5d88

Please sign in to comment.