We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想要实现统一修改server返回数据的格式,例如首字母都改成小写。
拦截器似乎无法修改到data,有没有合适的办法来实现这个功能呢?
谢谢。
The text was updated successfully, but these errors were encountered:
@CoolBerry 试试
request.use(async (ctx, next) => { await next(); const { res } = ctx; const { success = false } = res; // 假设返回结果为 : { success: false, errorCode: 'B001' } if (!success) { // 对异常情况做对应处理 } })
Sorry, something went wrong.
@CoolBerry 试试 request.use(async (ctx, next) => { await next(); const { res } = ctx; const { success = false } = res; // 假设返回结果为 : { success: false, errorCode: 'B001' } if (!success) { // 对异常情况做对应处理 } })
如果需要在判断success之后,把数据整理之后(处理之后结果res为any,没有success字段了)返回出去,怎么操作呢?
No branches or pull requests
想要实现统一修改server返回数据的格式,例如首字母都改成小写。
拦截器似乎无法修改到data,有没有合适的办法来实现这个功能呢?
谢谢。
The text was updated successfully, but these errors were encountered: