diff --git a/docs/tutorial/02-getting-started/02-quick-start.md b/docs/tutorial/02-getting-started/02-quick-start.md index 3daeacac24..398bc4a65c 100644 --- a/docs/tutorial/02-getting-started/02-quick-start.md +++ b/docs/tutorial/02-getting-started/02-quick-start.md @@ -59,10 +59,10 @@ In alova, you need to initiate a request through an alova instance. Let's create ```javascript import { createAlova } from 'alova'; -import fetchAdapter from 'alova/fetch'; +import adapterFetch from 'alova/fetch'; const alovaInstance = createAlova({ - requestAdapter: fetchAdapter() + requestAdapter: adapterFetch() }); ``` @@ -71,24 +71,24 @@ const alovaInstance = createAlova({ ```javascript const { createAlova } = require('alova'); -const fetchAdapter = require('alova/fetch'); +const adapterFetch = require('alova/fetch'); const alova = createAlova({ -requestAdapter: fetchAdapter(); +requestAdapter: adapterFetch(); }); ``` -> When using fetchAdapter in nodejs, the nodejs version requires `v17.5`, or you can use [axios request adapter](/resource/request-adapter/axios/). +> When using adapterFetch in nodejs, the nodejs version requires `v17.5`, or you can use [axios request adapter](/resource/request-adapter/axios/). ```javascript import { createAlova } from 'npm:alova'; -import fetchAdapter from 'npm:alova/fetch'; +import adapterFetch from 'npm:alova/fetch'; const alova = createAlova({ -requestAdapter: fetchAdapter(); +requestAdapter: adapterFetch(); }); ``` @@ -97,7 +97,7 @@ requestAdapter: fetchAdapter(); ## GET request -Send a request through `alovaInstance.Get`. Since the `fetchAdapter` request adapter is used, a `Response` instance will be received. This is very simple. +Send a request through `alovaInstance.Get`. Since the `adapterFetch` request adapter is used, a `Response` instance will be received. This is very simple. ```js const response = await alovaInstance diff --git a/docs/tutorial/02-getting-started/03-basic/08-server.md b/docs/tutorial/02-getting-started/03-basic/08-server.md index a7b4d04e9d..b1053860d0 100644 --- a/docs/tutorial/02-getting-started/03-basic/08-server.md +++ b/docs/tutorial/02-getting-started/03-basic/08-server.md @@ -6,10 +6,10 @@ As mentioned in the previous [Quick Start](/tutorial/getting-started/quick-start ```js import { createAlova } from 'alova'; -import fetchAdapter from 'alova/fetch'; +import adapterFetch from 'alova/fetch'; const alovaInstance = createAlova({ -requestAdapter: fetchAdapter() +requestAdapter: adapterFetch() }); alovaInstance.Get(...); diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/resource/01-request-adapter/01-alova-mock.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/resource/01-request-adapter/01-alova-mock.md index fe384e0839..da7e3bcba5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/resource/01-request-adapter/01-alova-mock.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/resource/01-request-adapter/01-alova-mock.md @@ -237,9 +237,9 @@ export const alovaInst = createAlova({ mock 数据一般只作用于开发环境,在生产环境下将会切换到实际的接口中,因此这段 mock 代码在生产环境就变得没有作用,此时我们可以通过环境变量的判断来排除这块代码,你只需要这样做: ```javascript -const fetchAdapter = adapterFetch(); +const adapterFetch = adapterFetch(); const mockAdapter = createAlovaMockAdapter([mockGroup1, /** ... */], { - httpAdapter: fetchAdapter, + httpAdapter: adapterFetch, delay: 1000, }); diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/02-quick-start.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/02-quick-start.md index 482a8e029a..af68400e96 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/02-quick-start.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/02-quick-start.md @@ -59,10 +59,10 @@ bun add alova ```javascript import { createAlova } from 'alova'; -import fetchAdapter from 'alova/fetch'; +import adapterFetch from 'alova/fetch'; const alovaInstance = createAlova({ - requestAdapter: fetchAdapter() + requestAdapter: adapterFetch() }); ``` @@ -71,24 +71,24 @@ const alovaInstance = createAlova({ ```javascript const { createAlova } = require('alova'); -const fetchAdapter = require('alova/fetch'); +const adapterFetch = require('alova/fetch'); const alova = createAlova({ - requestAdapter: fetchAdapter(); + requestAdapter: adapterFetch(); }); ``` -> 在 nodejs 中使用 fetchAdapter 时,nodejs 版本要求`v17.5`,或者你可以使用[axios 请求适配器](/resource/request-adapter/axios/)。 +> 在 nodejs 中使用 adapterFetch 时,nodejs 版本要求`v17.5`,或者你可以使用[axios 请求适配器](/resource/request-adapter/axios/)。 ```javascript import { createAlova } from 'npm:alova'; -import fetchAdapter from 'npm:alova/fetch'; +import adapterFetch from 'npm:alova/fetch'; const alova = createAlova({ - requestAdapter: fetchAdapter(); + requestAdapter: adapterFetch(); }); ``` @@ -97,7 +97,7 @@ const alova = createAlova({ ## GET 请求 -通过 `alovaInstance.Get` 发送一个请求,由于使用了`fetchAdapter`请求适配器,将会接收到一个`Response`实例,这很简单。 +通过 `alovaInstance.Get` 发送一个请求,由于使用了`adapterFetch`请求适配器,将会接收到一个`Response`实例,这很简单。 ```js const response = await alovaInstance diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/03-basic/08-server.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/03-basic/08-server.md index 6b3d740c67..4b8498f7a6 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/03-basic/08-server.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/02-getting-started/03-basic/08-server.md @@ -6,10 +6,10 @@ title: 在服务端使用 ```js import { createAlova } from 'alova'; -import fetchAdapter from 'alova/fetch'; +import adapterFetch from 'alova/fetch'; const alovaInstance = createAlova({ - requestAdapter: fetchAdapter() + requestAdapter: adapterFetch() }); alovaInstance.Get(...); diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/02-skills.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/02-skills.md index e77e665a54..636490c6cc 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/02-skills.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tutorial/07-project/01-best-practice/02-skills.md @@ -225,9 +225,9 @@ const handleInvalidateCache = id => { 如果你的项目,在开发环境下需要使用模拟数据模拟部分或全部接口,在生产切换回真实的网络请求,你可以通过环境变量来控制。 ```javascript -const fetchAdapter = adapterFetch(); +const adapterFetch = adapterFetch(); const mockAdapter = createAlovaMockAdapter([mockGroup1 /** ... */], { - httpAdapter: fetchAdapter, + httpAdapter: adapterFetch, delay: 1000 });