fix: 调整mock默认路由 (#8108)

* fix: 调整mock默认路由

1. starting改为running 语义更明确
2. API地址修复
3. 列表顺序调整,登录接口靠前

* docs: 替换axios调用示例

原先/api/user接口地址不对,且是受认证保护的接口,响应异常容易造成误解
This commit is contained in:
陆伯言
2026-07-01 13:02:44 +08:00
committed by GitHub
parent 9b356d731d
commit 5da38ccded
3 changed files with 19 additions and 15 deletions

View File

@@ -63,16 +63,18 @@ Based on the above configuration, we can use `/api` as the prefix for API reques
```ts
import axios from 'axios';
axios.get('/api/user').then((res) => {
console.log(res);
});
axios
.post('/api/auth/login', { username: 'vben', password: '123456' })
.then((res) => {
console.log(res);
});
```
At this point, the request will be proxied to `http://localhost:5320/api/user`.
At this point, the request will be proxied to `http://localhost:5320/api/auth/login`.
::: warning Note
From the browser's console Network tab, the request appears as `http://localhost:5555/api/user`. This is because the proxy configuration does not change the local request's URL.
From the browser's console Network tab, the request appears as `http://localhost:5555/api/auth/login`. This is because the proxy configuration does not change the local request's URL.
:::