feat: 修复插入表格数据时的错误处理问题
This commit is contained in:
parent
3f71247287
commit
61919e0155
@ -48,9 +48,11 @@ export const manageSheetReq = async (req: Request) => {
|
|||||||
body.range,
|
body.range,
|
||||||
body.values
|
body.values
|
||||||
);
|
);
|
||||||
|
if (insertRes?.code !== 0) {
|
||||||
|
return netTool.serverError(insertRes?.msg, insertRes?.data);
|
||||||
|
}
|
||||||
// 返回
|
// 返回
|
||||||
return netTool.ok(insertRes);
|
return netTool.ok(insertRes?.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return netTool.ok();
|
return netTool.ok();
|
||||||
|
@ -226,6 +226,6 @@ netTool.serverError = (msg: string, data?: any, requestId?: string) =>
|
|||||||
* @returns 一个表示200 OK的响应对象。
|
* @returns 一个表示200 OK的响应对象。
|
||||||
*/
|
*/
|
||||||
netTool.ok = (data?: any, requestId?: string) =>
|
netTool.ok = (data?: any, requestId?: string) =>
|
||||||
Response.json({ code: 200, msg: "ok", data, requestId });
|
Response.json({ code: 0, msg: "success", data, requestId });
|
||||||
|
|
||||||
export default netTool;
|
export default netTool;
|
||||||
|
@ -12,4 +12,4 @@ const res = await fetch(URL, {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(JSON.stringify(await res.text()));
|
console.log(JSON.stringify(await res.json(), null, 2));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user