Skip to content

Commit

Permalink
refactor($.http): $.http 改为返回原始 response 对象,其中包含 ret 对象
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `$.http` 改为返回原始 `response` 对象,其中包含 `ret` 对象
  • Loading branch information
twinh committed Jun 30, 2021
1 parent d61a5b0 commit f58ffe0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ $.ret = message.ret;
$.suc = message.success;
$.err = message.danger;

$.http = (...args) => axios(...args).then(({data}) => new Ret(data));
$.http = (...args) => axios(...args).then(res => {
res.ret = new Ret(res.data);
return res;
});

$.req = req.get.bind(req);
$.url = url.to.bind(url);
Expand Down

0 comments on commit f58ffe0

Please sign in to comment.