Skip to content

Commit

Permalink
fix: 修复接口返回无结构问题
Browse files Browse the repository at this point in the history
  • Loading branch information
JackySoft committed Sep 3, 2024
1 parent 9929288 commit 5a9337b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/editor/src/packages/utils/handleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export const handleApi = async (
res = { code: 0, data: res, msg: '' };
}
// 字段映射
const code = result.code ? Number(res[result.code]) : 0;
const data = result.data ? res[result.data] : res;
const msg = result.msg ? res[result.msg] : '';
const code = result.code ? Number(res[result.code] || 0) : 0;
const data = result.data ? res[result.data] || res : res;
const msg = result.msg ? res[result.msg] || '' : '';
if (code === result.codeValue) {
if (tips?.success) {
message.success(tips.success);
Expand Down
6 changes: 3 additions & 3 deletions packages/materials/utils/handleApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export const handleApi = async (
res = { code: 0, data: res, msg: '' };
}
// 字段映射
const code = result.code ? Number(res[result.code]) : 0;
const data = result.data ? res[result.data] : res;
const msg = result.msg ? res[result.msg] : '';
const code = result.code ? Number(res[result.code] || 0) : 0;
const data = result.data ? res[result.data] || res : res;
const msg = result.msg ? res[result.msg] || '' : '';
if (code === result.codeValue) {
if (tips?.success) {
message.success(tips.success);
Expand Down

0 comments on commit 5a9337b

Please sign in to comment.