@lark-apaas/coding-template-nestjs-react-fullstack 0.1.47-alpha.20260923111704 → 0.1.47-alpha.20261002215903
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/client/src/api/index.ts +12 -15
- package/template/package-lock.json +17921 -14118
- package/template/package.json +1 -0
- package/template/scripts/build.sh +609 -17
- package/template/server/common/filters/exception.filter.ts +69 -6
- package/template/server/common/interfaces/api_response.interface.ts +21 -2
- package/template/server/common/interfaces/exception.interface.ts +2 -2
- package/template/shared/api.interface.ts +1 -16
- package/template/client/src/api/error.ts +0 -84
- package/template/server/common/filters/error-response.ts +0 -92
package/package.json
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import { logger } from '@lark-apaas/client-toolkit/logger';
|
|
2
|
+
import { axiosForBackend } from '@lark-apaas/client-toolkit/utils/getAxiosForBackend';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// import { requireApiSuccess, toApiRequestError } from './error';
|
|
4
|
+
|
|
5
|
+
// Add more API functions here, use axios instance (`axiosForBackend`) to make requests.
|
|
6
|
+
//
|
|
7
|
+
// 使用示例:
|
|
8
8
|
// export async function getUserData(userId: string) {
|
|
9
|
-
// const errorOptions = { fallbackMessage: '获取用户数据失败,请稍后重试' };
|
|
10
9
|
// try {
|
|
11
|
-
// const response = await axiosForBackend({
|
|
12
|
-
//
|
|
10
|
+
// const response = await axiosForBackend({
|
|
11
|
+
// url: `/api/users/${userId}`,
|
|
12
|
+
// method: 'GET'
|
|
13
|
+
// });
|
|
14
|
+
// return response.data;
|
|
13
15
|
// } catch (error) {
|
|
14
|
-
// const apiError = toApiRequestError(error, errorOptions); // rejected 4xx / 网络错误
|
|
15
16
|
// logger.error('获取用户数据失败', error);
|
|
16
|
-
// throw
|
|
17
|
+
// throw error;
|
|
17
18
|
// }
|
|
18
19
|
// }
|
|
19
|
-
|
|
20
|
-
// 有已核实的旧端点将顶层 message:string|string[] 定义为用户文案时,才显式传
|
|
21
|
-
// { fallbackMessage: '操作失败,请稍后重试', allowLegacyUserMessage: true };默认只认 error.userFacing: true。
|
|
22
|
-
// 401 登录跳转由 axiosForBackend 自带拦截器负责,不在此处自行模拟登录。
|