From 73a6f23be6dce7b084e0edbfe86e7570efd8ad56 Mon Sep 17 00:00:00 2001 From: reslear Date: Wed, 16 Oct 2024 12:56:23 +0200 Subject: [PATCH] docs: v5 docs --- docs/content/1.index.yml | 4 ++-- docs/content/2.setup.md | 6 +++--- docs/content/3.usage.md | 4 ++-- docs/content/5.advanced.md | 12 ++++++------ 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/content/1.index.yml b/docs/content/1.index.yml index 6fbc757c..cbad59f3 100644 --- a/docs/content/1.index.yml +++ b/docs/content/1.index.yml @@ -21,7 +21,7 @@ hero: export default defineNuxtConfig({ modules: ['@nuxtjs/strapi'], strapi: { - version: 'v4', + version: 'v5', prefix: '/api' } }) @@ -32,7 +32,7 @@ features: - title: 'Nuxt 3 Ready' description: 'Leverage our auto-imported [composables](/usage) and our [devtools](/devtools) integration.' icon: 'i-simple-icons-nuxtdotjs' - - title: 'Strapi v3 & v4' + - title: 'Strapi v4/v3/v5' description: 'Works with the different versions of Strapi.' icon: 'i-simple-icons-strapi' - title: 'Authentication' diff --git a/docs/content/2.setup.md b/docs/content/2.setup.md index 2c73febf..d72e385c 100644 --- a/docs/content/2.setup.md +++ b/docs/content/2.setup.md @@ -32,7 +32,7 @@ Defaults: url: process.env.STRAPI_URL || 'http://localhost:1337', prefix: '/api', admin: '/admin', - version: 'v4', + version: 'v5', cookie: {}, cookieName: 'strapi_jwt' } @@ -68,13 +68,13 @@ Specify admin prefix used by your Strapi. ### `prefix` -Prefix of the Strapi server. Only used when version is `v4`. +Prefix of the Strapi server. Not for version `v3`. > Learn how to change the default [API prefix](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/api.html) in your Strapi server. ### `version` -Version of the Strapi server. Can only be `v4` or `v3`. +Version of the Strapi server. Can only be `v5`/`v4`/`v3`. ### `cookie` diff --git a/docs/content/3.usage.md b/docs/content/3.usage.md index 6bdc6ee1..bf234eb3 100644 --- a/docs/content/3.usage.md +++ b/docs/content/3.usage.md @@ -7,12 +7,12 @@ description: Learn how to use strapi module in your Nuxt 3 application. ## `useStrapi` -Depending on which version you have in your [options](/setup#options), you will be using either the v3 or v4 client. +Depending on which version you have in your [options](/setup#options), you will be using either the version you want client. ::callout{icon="i-heroicons-light-bulb"} All examples below are demonstrated with v4 `useStrapi()`. :br :br -Note that v3 exposes the same methods with different options. Check out specific types for [v3](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v3.d.ts) and [v4](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v4.d.ts). +Note that v3 exposes the same 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). :: > Learn how to handle Strapi errors globally by using [nuxt hooks](/advanced#errors-handling). diff --git a/docs/content/5.advanced.md b/docs/content/5.advanced.md index 396ba49f..d8c0d872 100644 --- a/docs/content/5.advanced.md +++ b/docs/content/5.advanced.md @@ -72,14 +72,14 @@ definePageMeta({ You can use the nuxt `strapi:error` hook to display a toast for example (the following example assumes that a `$toast` plugin has been injected). -Here are examples for both `v4` and `v3` as the signature between both versions is different. +Here are examples for both `v5`/`v4` and `v3` as the signature between both versions is different. > Learn how to change the version in the [options](/setup#options). -### `v4` +### `v5`/`v4` ```ts [plugins/strapi.client.ts] -import type { Strapi4Error } from '@nuxtjs/strapi' +import type { Strapi4Error, Strapi5Error } from '@nuxtjs/strapi' export default defineNuxtPlugin((nuxt) => { nuxt.hook('strapi:error' as any, (e: Strapi4Error) => { @@ -88,7 +88,7 @@ export default defineNuxtPlugin((nuxt) => { }) ``` -> Check out the [Strapi4Error](https://github.com/nuxt-modules/strapi/blob/dev/src/runtime/types/v4.d.ts#L3) type. +> 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. ### `v3` @@ -123,7 +123,7 @@ By default, when calling `/users/me` route, Strapi only returns the user populat Here is how to override this method for both Strapi v3 and v4 by adding our own custom relation, in this example `restaurants`: -### `v4` +### `v5`/`v4` ```js [src/index.js] module.exports = { @@ -137,7 +137,7 @@ module.exports = { } ``` -> Note that in Strapi v4, you must enable the `restaurants.find` permission in your admin for the Authenticated role to have the data populated. +> 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. ### `v3`