Skip to content

Commit eab8416

Browse files
committed
docs: fix outdated references, broken links and typos
1 parent 62082bb commit eab8416

6 files changed

Lines changed: 47 additions & 55 deletions

File tree

docs/content/2.setup.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
title: Setup
3-
description: Learn how to setup strapi module in your Nuxt 3 application.
3+
description: Learn how to setup the Strapi module in your Nuxt application.
44
navigation.icon: i-lucide-play
55
---
66

77
## Installation
88

9-
1. Add `@nuxtjs/strapi` module to your project:
9+
Add `@nuxtjs/strapi` module to your project:
1010

1111
```bash
1212
npx nuxi@latest module add strapi
1313
```
1414

15-
2. Add it to the `modules` section in your `nuxt.config.ts`:
15+
This will add the module to the `modules` section of your `nuxt.config.ts`. You can then configure it:
1616

1717
```ts [nuxt.config.ts]
1818
export default defineNuxtConfig({
@@ -39,7 +39,7 @@ Defaults:
3939
}
4040
```
4141

42-
If you want to override any options on runtime, you may use [Nuxt 3 runtime-config](https://nuxt.com/docs/getting-started/configuration#environment-variables-and-private-tokens):
42+
If you want to override any options on runtime, you may use [Nuxt runtime-config](https://nuxt.com/docs/getting-started/configuration#environment-variables-and-private-tokens):
4343

4444
```ts [nuxt.config.ts]
4545
export default defineNuxtConfig({

docs/content/3.usage.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@ navigation.icon: i-lucide-code
1010

1111
Depending on which version you have in your [options](/setup#options), you will be using either the v5 (default), v4 or v3 client.
1212

13-
::prose-tip
13+
::tip
1414
All examples below are demonstrated with the default v5 `useStrapi()`. :br
1515
:br
16-
Note that v3/v4 expose similar methods with different options. Check out specific types for [v5](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts), [v4](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v4.ts) or [v3](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v3.ts).
16+
Note that v3/v4 expose similar methods with different options. Check out specific types for [v5](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts), [v4](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v4.ts) or [v3](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v3.ts).
1717
::
1818

1919
> Learn how to handle Strapi errors globally by using [nuxt hooks](/advanced#errors-handling).
2020
21-
::prose-warning
21+
::warning
2222
All examples below are demonstrated with http calls in script setup. However, to handle SSR properly you may want to use [useAsyncData](/advanced#async-data).
2323
::
2424

25-
### Types
26-
2725
When using the composable, you can pass in a default data model for all methods.
2826

2927
```ts
@@ -48,7 +46,7 @@ Get a list of documents. Returns entries matching the query filters (see [parame
4846

4947
- **Arguments:**
5048
- contentType: `string`
51-
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts)
49+
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts)
5250
- fetchOptions?: [`FetchOptions`](https://github.com/unjs/ofetch/blob/main/src/types.ts#L34)
5351
- **Returns:** `Promise<Strapi5ResponseMany<T>>`
5452

@@ -71,7 +69,7 @@ Returns a document by `documentId`.
7169
- **Arguments:**
7270
- contentType: `string`
7371
- documentId: `string`
74-
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts) (without `filters`)
72+
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts) (without `filters`)
7573
- fetchOptions?: [`FetchOptions`](https://github.com/unjs/ofetch/blob/main/src/types.ts#L34)
7674
- **Returns:** `Promise<Strapi5ResponseSingle<T>>`
7775

@@ -95,7 +93,7 @@ Creates a document and returns its value.
9593
- **Arguments:**
9694
- contentType: `string`
9795
- data: `Partial<T>`
98-
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts) (without `filters`)
96+
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts) (without `filters`)
9997
- **Returns:** `Promise<Strapi5ResponseSingle<T>>`
10098

10199
```vue
@@ -120,7 +118,7 @@ Partially updates a document by `documentId` and returns its value. Fields that
120118
- contentType: `string`
121119
- documentId: `string`
122120
- data?: `Partial<T>`
123-
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts) (without `filters`)
121+
- params?: [`Strapi5RequestParams`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts) (without `filters`)
124122
- **Returns:** `Promise<Strapi5ResponseSingle<T>>`
125123

126124
```vue
@@ -159,7 +157,7 @@ const onSubmit = async () => {
159157
</script>
160158
```
161159

162-
::prose-tip
160+
::tip
163161
Pass `locale` to delete a specific locale version: `_delete('restaurants', id, { locale: 'fr' })`
164162
::
165163

@@ -169,13 +167,13 @@ Pass `locale` to delete a specific locale version: `_delete('restaurants', id, {
169167

170168
Returns the count of entries matching the query filters. You can read more about parameters [here](https://docs-v3.strapi.io/developer-docs/latest/developer-resources/content-api/content-api.html#api-parameters).
171169

172-
::prose-warning
170+
::warning
173171
Available only for `v3` as Strapi v4 can do the same thing with the [Pagination queries](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#pagination) of the `find` method.
174172
::
175173

176174
- **Arguments:**
177175
- contentType: `string`
178-
- params?: [`Strapi3RequestParams`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v3.d.ts#L9)
176+
- params?: [`Strapi3RequestParams`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v3.ts#L9)
179177
- **Returns:** `Promise<number>`
180178

181179
```vue
@@ -194,7 +192,7 @@ This composable is an alias of `useStrapiClient` that sets the `url` to `/graphq
194192

195193
- **Arguments:**
196194
- query: `string|DocumentNode`
197-
- variables (optional): [`StrapiGraphqlVariables`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L570)
195+
- variables (optional): [`StrapiGraphqlVariables`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L570)
198196
- **Returns:** `Promise<T>`
199197

200198
```vue
@@ -205,13 +203,9 @@ const graphql = useStrapiGraphQL()
205203
// Option 1: use inline query
206204
const restaurant = await graphql(`
207205
query {
208-
restaurant(id: ${route.params.id}) {
209-
data {
210-
id
211-
attributes {
212-
name
213-
}
214-
}
206+
restaurant(documentId: "${route.params.id}") {
207+
documentId
208+
name
215209
}
216210
}
217211
`)
@@ -223,12 +217,12 @@ const restaurant = await graphql(query, { id: route.params.id })
223217

224218
## `useStrapiClient`
225219

226-
This composable is a wrapper around [Nuxt 3 `$fetch` helper](https://nuxt.com/docs/api/utils/dollarfetch) that uses [`ofetch`](https://github.com/unjs/ofetch) under the hood. You can use this method to reach custom strapi endpoints not available in the `useStrapi` composable.
220+
This composable is a wrapper around [Nuxt `$fetch` helper](https://nuxt.com/docs/api/utils/dollarfetch) that uses [`ofetch`](https://github.com/unjs/ofetch) under the hood. You can use this method to reach custom strapi endpoints not available in the `useStrapi` composable.
227221

228222
- **Arguments:**
229223
- url: `string`
230224
- fetchOptions?: [`FetchOptions`](https://github.com/unjs/ofetch/blob/main/src/types.ts#L34)
231-
- **Returns:** `Promise<number>`
225+
- **Returns:** `Promise<T>`
232226

233227
```vue
234228
<script setup lang="ts">

docs/content/4.auth.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: Authentication
3-
description: Learn how to authenticate users with the strapi module in your Nuxt 3 application.
3+
description: Learn how to authenticate users with the Strapi module in your Nuxt application.
44
navigation.icon: i-lucide-lock
55
---
66

7-
> This module exposes composables that are [auto-imported](https://nuxt.com/docs/guide/directory-structure/composables) by Nuxt 3.
7+
> This module exposes composables that are [auto-imported](https://nuxt.com/docs/guide/directory-structure/composables) by Nuxt.
88
99
## Configuration
1010

1111
When using `@nuxtjs/strapi` for authentication, the user jwt token will be stored in a cookie (`strapi_jwt` by default). By using the default cookie configuration, the expiration will be set to `Session`, which means the cookie will disappear when the browser is closed, and users will have to log in everytime.
1212

13-
If you want your cookie to stay longer, we recommand to use the configuration below (expiration is set to 14 days, feel free to change it):
13+
If you want your cookie to stay longer, we recommend using the configuration below (expiration is set to 14 days, feel free to change it):
1414

1515
```ts [nuxt.config.ts]
1616
export default defineNuxtConfig({
@@ -47,7 +47,7 @@ const token = useStrapiToken()
4747

4848
This composable exposes all the methods available in the Strapi [Users & Permissions plugin](https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html).
4949

50-
::prose-tip
50+
::tip
5151
On `login`, `register`, `resetPassword` and `authenticateProvider` methods, the user is populated through the [`fetchUser`](/auth#fetchuser) method.
5252
::
5353

@@ -56,8 +56,8 @@ On `login`, `register`, `resetPassword` and `authenticateProvider` methods, the
5656
Submit the user's identifier and password credentials for authentication. Sets [`user`](/auth#usestrapiuser) and [`token`](/auth#usestrapitoken).
5757

5858
- **Arguments:**
59-
- data: [`StrapiAuthenticationData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L538)
60-
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L533)
59+
- data: [`StrapiAuthenticationData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L538)
60+
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L533)
6161

6262
```vue [pages/login.vue]
6363
<script setup lang="ts">
@@ -100,8 +100,8 @@ Creates a new user in the database with a default role as `Authenticated`.
100100
Custom user fields, if added to the content type, e.g. `phoneNumber`, can be added to the payload as well.
101101

102102
- **Arguments:**
103-
- data: [`StrapiRegistrationData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L543)
104-
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L533)
103+
- data: [`StrapiRegistrationData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L543)
104+
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L533)
105105

106106
```vue [pages/register.vue]
107107
<script setup lang="ts">
@@ -125,7 +125,7 @@ const onSubmit = async () => {
125125
This action sends an email to a user with the link to your own reset password page. The link will be enriched with the url param code that is needed for the [`resetPassword`](/auth#resetpassword).
126126

127127
- **Arguments:**
128-
- data: [`StrapiForgotPasswordData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L550)
128+
- data: [`StrapiForgotPasswordData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L550)
129129
- **Returns:** `Promise<void>`
130130

131131
```vue [pages/forgot.vue]
@@ -150,8 +150,8 @@ const onSubmit = async () => {
150150
This action will update the user password. Sets [`user`](/auth#usestrapiuser) and [`token`](/auth#usestrapitoken).
151151

152152
- **Arguments:**
153-
- data: [`StrapiResetPasswordData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L554)
154-
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L533)
153+
- data: [`StrapiResetPasswordData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L554)
154+
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L533)
155155

156156
```vue [pages/reset.vue]
157157
<script setup lang="ts">
@@ -175,7 +175,7 @@ const onSubmit = async () => {
175175
You can also update an authenticated user password through the `/change-password` API endpoint:
176176

177177
- **Arguments:**
178-
- data: [`StrapiChangePasswordData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L560)
178+
- data: [`StrapiChangePasswordData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L560)
179179
- **Returns:** `Promise<void>`
180180

181181
```vue
@@ -199,7 +199,7 @@ const onSubmit = async () => {
199199
This action will re-send the confirmation sent after [`registration`](/auth#register).
200200

201201
- **Arguments:**
202-
- data: [`StrapiEmailConfirmationData`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L566)
202+
- data: [`StrapiEmailConfirmationData`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L566)
203203
- **Returns:** `Promise<void>`
204204

205205
```vue
@@ -223,7 +223,7 @@ const onSubmit = async () => {
223223
Return the correct URL to authenticate with provider.
224224

225225
- **Arguments:**
226-
- provider: [`StrapiAuthProvider`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L505)
226+
- provider: [`StrapiAuthProvider`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L505)
227227
- **Returns:** `string`
228228

229229
```vue [pages/login.vue]
@@ -241,9 +241,9 @@ const onClick = () => {
241241
Authenticate user with external provider. Sets [`user`](/auth#usestrapiuser) and [`token`](/auth#usestrapitoken).
242242

243243
- **Arguments:**
244-
- provider: [`StrapiAuthProvider`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L505)
244+
- provider: [`StrapiAuthProvider`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L505)
245245
- access_token: `string`
246-
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/index.d.ts#L533)
246+
- **Returns:** [`Promise<StrapiAuthenticationResponse>`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/index.ts#L533)
247247

248248
```vue [pages/auth/[provider]/callback.vue]
249249
<script setup lang="ts">
@@ -258,7 +258,7 @@ await authenticateProvider('github', route.query.access_token)
258258

259259
Fetch `me` user from `/users/me` route if a [`token`](/auth#usestrapitoken) exists in the cookies then sets [`user`](/auth#usestrapiuser).
260260

261-
::prose-tip
261+
::tip
262262
This method is called on the server-side only and the data are hydrated client-side so the HTTP call happens only once. This method is called by default on init through a [Nuxt plugin](https://nuxt.com/docs/guide/directory-structure/plugins), so you don't have to.
263263
::
264264

docs/content/5.advanced.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ Here are examples for both `v5`/`v4` and `v3` as the signature between both vers
8080
### `v5`/`v4`
8181

8282
```ts [plugins/strapi.client.ts]
83-
import type { Strapi4Error, Strapi5Error } from '@nuxtjs/strapi'
83+
import type { Strapi5Error } from '@nuxtjs/strapi'
8484

8585
export default defineNuxtPlugin((nuxt) => {
86-
nuxt.hook('strapi:error' as any, (e: Strapi4Error) => {
86+
nuxt.hook('strapi:error' as any, (e: Strapi5Error) => {
8787
nuxt.$toast.error({ title: e.error.name, description: e.error.message })
8888
})
8989
})
9090
```
9191

92-
> Check out the [Strapi5Error](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v5.ts#L3) or [Strapi4Error](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v4.ts#L3) type.
92+
> Check out the [Strapi5Error](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v5.ts#L3) or [Strapi4Error](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v4.ts#L3) type.
9393
9494
### `v3`
9595

@@ -112,11 +112,11 @@ export default defineNuxtPlugin((nuxt) => {
112112
})
113113
```
114114

115-
> Check out the [Strapi3Error](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v3.d.ts#L3) type.
115+
> Check out the [Strapi3Error](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/types/v3.ts#L3) type.
116116
117117
## Override Strapi `/users/me` route
118118

119-
::prose-tip
119+
::tip
120120
Since [v1.5.0](https://github.com/nuxt-modules/strapi/releases/tag/v1.5.0) and Strapi [v4.2.2](https://github.com/strapi/strapi/releases/tag/v4.2.2), you can use the [`auth.populate`](/setup#authpopulate) option to populate data from `/users/me` route.
121121
::
122122

@@ -138,7 +138,7 @@ module.exports = {
138138
}
139139
```
140140

141-
> Note that in Strapi v4 v5, you must enable the `restaurants.find` permission in your admin for the Authenticated role to have the data populated.
141+
> Note that in Strapi v4/v5, you must enable the `restaurants.find` permission in your admin for the Authenticated role to have the data populated.
142142
143143
### `v3`
144144

@@ -180,7 +180,7 @@ async function onSubmit () {
180180
</script>
181181
```
182182

183-
> Note that you have to use the `client` because `create` and `update` methods sends the [body inside `data`](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/composables/useStrapi4.ts#L64).
183+
> Note that you have to use the `client` because `create` and `update` methods sends the [body inside `data`](https://github.com/nuxt-modules/strapi/blob/main/src/runtime/composables/useStrapi4.ts#L64).
184184
185185
## Use Imported GraphQL
186186

docs/content/6.devtools.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,14 @@ Restart your Strapi server and it should be ready to be embedded in the devtools
4343

4444
Open your `nuxt.config.ts` and set the `devtools` option to `true`:
4545

46-
::code-group
4746
```ts [nuxt.config.ts]
4847
export default defineNuxtConfig({
4948
strapi: {
5049
devtools: true
5150
}
5251
})
5352
```
54-
::
5553

56-
::prose-tip{icon="i-lucide-sparkles"}
54+
::tip
5755
You should now see your Strapi Admin right into your Nuxt project by opening the devtools :sparkles:
5856
::

docs/content/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Shipped with many features.
4848
icon: i-simple-icons-nuxtdotjs
4949
---
5050
#title{unwrap="p"}
51-
Nuxt 3 Ready
51+
Nuxt Ready
5252
#description{unwrap="p"}
5353
Leverage our auto-imported [composables](/usage) and our [devtools](/devtools) integration.
5454
:::
@@ -58,7 +58,7 @@ Shipped with many features.
5858
icon: i-simple-icons-strapi
5959
---
6060
#title{unwrap="p"}
61-
Strapi v4/v3/v5
61+
Strapi v5/v4/v3
6262
#description{unwrap="p"}
6363
Works with the different versions of Strapi.
6464
:::

0 commit comments

Comments
 (0)