Skip to content

Commit

Permalink
fix headings and remove redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
victoriaxyz committed Dec 13, 2024
1 parent e6a9deb commit 474ba30
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 88 deletions.
16 changes: 3 additions & 13 deletions docs/references/vue/use-auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,7 @@ description: Access and manage authentication state in your Vue application with

The `useAuth()` composable provides access to the current authentication state and methods to manage the active session in your Vue application.

## Usage

```vue
<script setup>
import { useAuth } from '@clerk/vue'
const { isSignedIn, getToken } = useAuth()
</script>
```

## Return values
## `useAuth()` returns

<Properties>
- `isLoaded`
Expand Down Expand Up @@ -87,9 +77,9 @@ const { isSignedIn, getToken } = useAuth()
A function that returns a boolean indicating whether the user has specific permissions or roles. See the [reference doc](/docs/references/javascript/auth-object#has).
</Properties>

## Example
## How to use the `useAuth()` composable

The following example demonstrates how to use `useAuth()` to access the authentication state, protect a page, and fetch data from an external API:
Use `useAuth()` to access the authentication state, protect a page, and fetch data from an external API:

```vue {{ filename: 'App.vue' }}
<script setup>
Expand Down
11 changes: 6 additions & 5 deletions docs/references/vue/use-clerk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ description: Access and manage the Clerk instance in your Vue application with C
The `useClerk()` composable provides access to the [`Clerk`](/docs/references/javascript/clerk/clerk) object, giving you the ability to build alternatives to any [Clerk component](/docs/components/overview).

## Usage
## `useClerk()` returns

The `useClerk()` composable returns the `Clerk` object, which includes all the methods and properties listed in the [`Clerk` reference](/docs/references/javascript/clerk/clerk).


## How to use the `useClerk()` composable

```vue
<script setup>
Expand All @@ -21,7 +26,3 @@ const clerk = useClerk()
<button @click="clerk.openSignIn">Sign in</button>
</template>
```

## Return Value

The `useClerk()` composable returns the `Clerk` object, which includes all the methods and properties listed in the [`Clerk` reference](/docs/references/javascript/clerk/clerk).
70 changes: 23 additions & 47 deletions docs/references/vue/use-sign-in.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,7 @@ description: Access and manage sign-in state in your Vue application with Clerk'

The `useSignIn()` composable provides access to the [`SignIn`](/docs/references/javascript/sign-in/sign-in) object, which allows you to check the current state of a sign-in attempt and manage the sign-in flow. You can use this to create a [custom sign-in flow](/docs/custom-flows/overview#sign-in-flow).

## Usage

```vue
<script setup>
import { useSignIn } from '@clerk/vue'
const { isLoaded, signIn, setActive } = useSignIn()
</script>
```

```ts
function useSignIn(): {
isLoaded: Ref<boolean>
signIn: Ref<SignIn>
setActive: Ref<(params: SetActiveParams) => Promise<void>>
}
```

## Reference

### Return values
## `useSignIn()` returns

<Properties>
- `isLoaded`
Expand All @@ -48,9 +28,7 @@ function useSignIn(): {
An object that contains the current sign-in attempt status and methods to create a new sign-in attempt.
</Properties>

### Types

#### `SetActiveParams`
### `SetActiveParams`

<Properties>
- `session`
Expand All @@ -73,7 +51,27 @@ function useSignIn(): {
Callback run just before the active session and/or organization is set to the passed object. Can be used to set up for pre-navigation actions.
</Properties>

#### `SignIn` status values
## How to use the `useSignIn()` composable

Use `useSignIn()` to check the current sign-in status and display the value in the UI.

```vue {{ filename: 'SignInPage.vue' }}
<script setup>
import { useSignIn } from '@clerk/vue'
const { isLoaded, signIn } = useSignIn()
</script>
<template>
<div v-if="!isLoaded">
<!-- Add logic to handle loading state -->
</div>
<div v-else>The current sign in attempt status is {{ signIn.status }}.</div>
</template>
```

### `SignIn` status values

The `status` property of the `SignIn` object can be one of the following values:

Expand Down Expand Up @@ -111,25 +109,3 @@ The `status` property of the `SignIn` object can be one of the following values:

The user needs to set a new password.
</Properties>

## Example

### Check and show sign-in status

The following example checks the current sign-in status and displays the value in the UI.

```vue {{ filename: 'SignInPage.vue' }}
<script setup>
import { useSignIn } from '@clerk/vue'
const { isLoaded, signIn } = useSignIn()
</script>
<template>
<div v-if="!isLoaded">
<!-- Add logic to handle loading state -->
</div>
<div v-else>The current sign in attempt status is {{ signIn.status }}.</div>
</template>
```
26 changes: 3 additions & 23 deletions docs/references/vue/use-user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,7 @@ description: Access and manage the current user's data in your Vue application w

The `useUser()` composable provides access to the current user's [`User`](/docs/references/javascript/user/user) object, which contains all the data for a single user in your application and provides methods to manage their account. This composable also allows you to check if the user is signed in and if Clerk has loaded and initialized.

## Usage

```vue
<script setup>
import { useUser } from '@clerk/vue'
const { isLoaded, user, isSignedIn } = useUser()
</script>
```

```ts
function useUser(): {
isLoaded: Ref<boolean>
user: Ref<User>
isSignedIn: Ref<boolean>
}
```

## Reference

### Return values
## `useUser()` returns

<Properties>
- `isLoaded`
Expand All @@ -48,7 +28,7 @@ function useUser(): {
A boolean that returns `true` if the user is signed in.
</Properties>

## Examples
## How to use the `useUser()` composable

### Get the current user

Expand All @@ -74,7 +54,7 @@ const { isSignedIn, user, isLoaded } = useUser()

### Update user data

Use [`update()`](/docs/references/javascript/user/user#update) to update the current user's information:
Use [`update()`](/docs/references/javascript/user/user#update) to update the current user's information.

```vue {{ filename: 'UpdateUser.vue' }}
<script setup>
Expand Down

0 comments on commit 474ba30

Please sign in to comment.